From 92e2d41eba737fb7c0d2675ecab5621cccc4f24c Mon Sep 17 00:00:00 2001 From: Lukhnos Liu Date: Thu, 13 Dec 2012 19:50:04 -0800 Subject: [PATCH] Clean up reading buf at deactivation (fixes #72) --- Source/InputMethodController.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index 9dca4904..1684a59e 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -304,8 +304,15 @@ public: - (void)deactivateServer:(id)client { + // clean up reading buffer residues + if (!_bpmfReadingBuffer->isEmpty()) { + _bpmfReadingBuffer->clear(); + [client setMarkedText:@"" selectionRange:NSMakeRange(0, 0) replacementRange:NSMakeRange(NSNotFound, NSNotFound)]; + } + // commit any residue in the composing buffer [self commitComposition:client]; + _currentDeferredClient = nil; _currentCandidateClient = nil;