diff options
author | Neil <nyamatongwe@gmail.com> | 2021-05-05 09:34:24 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-05-05 09:34:24 +1000 |
commit | 9b8ce7d9a3b7cbfe1a56fdb422f9e91b8f3ece14 (patch) | |
tree | 70423c5e4422778e708df92d92021de7a76d002a | |
parent | aecda22f08cfe2c137c7f6fb8d8669e91426f4b2 (diff) | |
download | scintilla-mirror-9b8ce7d9a3b7cbfe1a56fdb422f9e91b8f3ece14.tar.gz |
Redraw when focus changes. Move hasFocus to EditModel where it can be used for
drawing more easily.
-rw-r--r-- | src/EditModel.cxx | 1 | ||||
-rw-r--r-- | src/EditModel.h | 1 | ||||
-rw-r--r-- | src/Editor.cxx | 5 | ||||
-rw-r--r-- | src/Editor.h | 1 |
4 files changed, 6 insertions, 2 deletions
diff --git a/src/EditModel.cxx b/src/EditModel.cxx index d84ad7e21..35a2bc549 100644 --- a/src/EditModel.cxx +++ b/src/EditModel.cxx @@ -66,6 +66,7 @@ EditModel::EditModel() : braces{} { braces[1] = Sci::invalidPosition; bracesMatchStyle = STYLE_BRACEBAD; highlightGuideColumn = 0; + hasFocus = false; primarySelection = true; imeInteraction = IMEInteraction::windowed; bidirectional = Bidirectional::bidiDisabled; diff --git a/src/EditModel.h b/src/EditModel.h index 8d30267f0..e2f3e20e0 100644 --- a/src/EditModel.h +++ b/src/EditModel.h @@ -33,6 +33,7 @@ public: Sci::Position braces[2]; int bracesMatchStyle; int highlightGuideColumn; + bool hasFocus; Selection sel; bool primarySelection; diff --git a/src/Editor.cxx b/src/Editor.cxx index adc9f3492..59d5d54e6 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -122,7 +122,6 @@ Editor::Editor() : durationWrapOneLine(0.00001, 0.000001, 0.0001) { cursorMode = SC_CURSORNORMAL; - hasFocus = false; errorStatus = 0; mouseDownCaptures = true; mouseWheelCaptures = true; @@ -5072,7 +5071,11 @@ void Editor::FineTickerCancel(TickReason) { } void Editor::SetFocusState(bool focusState) { + const bool changing = hasFocus != focusState; hasFocus = focusState; + if (changing) { + Redraw(); + } NotifyFocus(hasFocus); if (!hasFocus) { CancelModes(); diff --git a/src/Editor.h b/src/Editor.h index 1ee6be643..eabd7517e 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -188,7 +188,6 @@ protected: // ScintillaBase subclass needs access to much of Editor int cursorMode; - bool hasFocus; bool mouseDownCaptures; bool mouseWheelCaptures; |