diff options
author | Neil <nyamatongwe@gmail.com> | 2014-07-23 09:58:59 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-07-23 09:58:59 +1000 |
commit | 143e44e7bfc8097b96a95c929481c8c42ae27542 (patch) | |
tree | f14b2bd4adef4860c13d4c2baf00547c57e82b2f | |
parent | d5997d9def9915606228f5a0254ad55d0183ba1a (diff) | |
download | scintilla-mirror-143e44e7bfc8097b96a95c929481c8c42ae27542.tar.gz |
Limit and simplify variable lifetimes used in the IME code.
From johnsonj and Neil.
-rw-r--r-- | win32/ScintillaWin.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 1f2c354f5..bec0fe70c 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -206,7 +206,6 @@ class ScintillaWin : static HINSTANCE hInstance; int tmpCaretStyle; - bool compstrExist; #if defined(USE_D2D) ID2D1HwndRenderTarget *pRenderTarget; @@ -349,7 +348,6 @@ ScintillaWin::ScintillaWin(HWND hwnd) { SetCoalescableTimerFn = 0; tmpCaretStyle = 0; - compstrExist = false; linesPerScroll = 0; wheelDelta = 0; // Wheel delta from roll @@ -731,30 +729,29 @@ sptr_t ScintillaWin::HandleCompositionKoreanIME(uptr_t, sptr_t lParam) { const int maxLenInputIME = 4; wchar_t wcs[maxLenInputIME]; int wides = 0; - - // for avoiding inOverstrike condition in AddCharUTF() - bool tmpOverstrike = inOverstrike; + bool compstrExist = false; if (pdoc->TentativeActive()) { pdoc->TentativeUndo(); } else { // No tentative undo means start of this composition so // fill in any virtual spaces. + bool tmpOverstrike = inOverstrike; + inOverstrike = false; // not allow to be deleted twice. AddCharUTF("", 0, false); + inOverstrike = tmpOverstrike; } if (lParam & GCS_COMPSTR) { long bytes = ::ImmGetCompositionStringW (hIMC, GCS_COMPSTR, wcs, maxLenInputIME); wides = bytes / 2; - inOverstrike = inOverstrike && (!compstrExist); compstrExist = (wides != 0); } else if (lParam & GCS_RESULTSTR) { long bytes = ::ImmGetCompositionStringW (hIMC, GCS_RESULTSTR, wcs, maxLenInputIME); wides = bytes / 2; compstrExist = (wides == 0); - inOverstrike = inOverstrike && (wides >= 2); } if (wides >= 1) { @@ -805,7 +802,6 @@ sptr_t ScintillaWin::HandleCompositionKoreanIME(uptr_t, sptr_t lParam) { ::ImmSetCandidateWindow(hIMC, &CandForm); ShowCaretAtCurrentPosition(); - inOverstrike = tmpOverstrike; ::ImmReleaseContext(MainHWND(), hIMC); return 0; } |