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 | ad82727b393c55f6ff3ecae25abcb140d4d4079c (patch) | |
| tree | 6163e41d7bc78417b0317ded3d262a7d1974740c | |
| parent | 9c9ff508d34fa2986af65826aad53e9fa6511b0d (diff) | |
| download | scintilla-mirror-ad82727b393c55f6ff3ecae25abcb140d4d4079c.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;  } | 
