diff options
author | Neil <nyamatongwe@gmail.com> | 2016-11-11 13:04:53 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2016-11-11 13:04:53 +1100 |
commit | a8f96c1772bfaec14d91e2a1fe293879019770bb (patch) | |
tree | 0a91e042cd1204996b19fe8594b85783c9c8cf84 | |
parent | bd6b3866b43b54f2fdb58ea5435b04f75c0d2159 (diff) | |
download | scintilla-mirror-a8f96c1772bfaec14d91e2a1fe293879019770bb.tar.gz |
Make IME indicator visible in single phase drawing mode.
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 6 | ||||
-rw-r--r-- | cocoa/ScintillaView.h | 2 | ||||
-rw-r--r-- | cocoa/ScintillaView.mm | 22 |
3 files changed, 24 insertions, 6 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 3ae4ab575..90752d71c 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -894,6 +894,12 @@ sptr_t ScintillaCocoa::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPar HideFindIndicator(); return 0; + case SCI_SETPHASESDRAW: { + sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); + [ContentView().owner updateIndicatorIME]; + return r; + } + default: sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index c397cad8d..82e8e3bca 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -130,6 +130,8 @@ extern NSString *const SCIUpdateUINotification; - (void) suspendDrawing: (BOOL) suspend; - (void) notification: (Scintilla::SCNotification*) notification; +- (void) updateIndicatorIME; + // Scroller handling - (void) setMarginWidth: (int) width; - (SCIContentView*) content; diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 83e8f5398..8afb04f79 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -1386,6 +1386,21 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context //-------------------------------------------------------------------------------------------------- /** + * Setup a special indicator used in the editor to provide visual feedback for + * input composition, depending on language, keyboard etc. + */ +- (void) updateIndicatorIME +{ + [self setColorProperty: SCI_INDICSETFORE parameter: INDIC_IME fromHTML: @"#FF0000"]; + const bool drawInBackground = [self message: SCI_GETPHASESDRAW] != 0; + [self setGeneralProperty: SCI_INDICSETUNDER parameter: INDIC_IME value: drawInBackground]; + [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INDIC_IME value: INDIC_PLAIN]; + [self setGeneralProperty: SCI_INDICSETALPHA parameter: INDIC_IME value: 100]; +} + +//-------------------------------------------------------------------------------------------------- + +/** * Initialization of the view. Used to setup a few other things we need. */ - (id) initWithFrame: (NSRect) frame @@ -1424,12 +1439,7 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context // which require our attention. mBackend->SetDelegate(self); - // Setup a special indicator used in the editor to provide visual feedback for - // input composition, depending on language, keyboard etc. - [self setColorProperty: SCI_INDICSETFORE parameter: INDIC_IME fromHTML: @"#FF0000"]; - [self setGeneralProperty: SCI_INDICSETUNDER parameter: INDIC_IME value: 1]; - [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INDIC_IME value: INDIC_PLAIN]; - [self setGeneralProperty: SCI_INDICSETALPHA parameter: INDIC_IME value: 100]; + [self updateIndicatorIME]; NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self |