diff options
author | Zufu Liu <unknown> | 2019-06-30 08:34:46 +1000 |
---|---|---|
committer | Zufu Liu <unknown> | 2019-06-30 08:34:46 +1000 |
commit | d7e2afd1f88bf735b010461ff505470bfa468547 (patch) | |
tree | 0305fc8fd126909438c6da42cf90d53a3201b8c2 /src/Editor.cxx | |
parent | 24bff87107d89a09e724993e053e7151945596e8 (diff) | |
download | scintilla-mirror-d7e2afd1f88bf735b010461ff505470bfa468547.tar.gz |
Bug [#2038]. Source of input reported in SCN_CHARADDED.
This may be SC_CHARACTERSOURCE_DIRECT_INPUT, SC_CHARACTERSOURCE_TENTATIVE_INPUT,
or SC_CHARACTERSOURCE_IME_RESULT.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 92c77571e..2cf12f61f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1891,7 +1891,7 @@ void Editor::AddChar(char ch) { char s[2]; s[0] = ch; s[1] = '\0'; - InsertCharacter(std::string_view(s, 1)); + InsertCharacter(std::string_view(s, 1), CharacterSource::directInput); } void Editor::FilterSelections() { @@ -1902,7 +1902,7 @@ void Editor::FilterSelections() { } // InsertCharacter inserts a character encoded in document code page. -void Editor::InsertCharacter(std::string_view sv) { +void Editor::InsertCharacter(std::string_view sv, CharacterSource charSource) { if (sv.empty()) { return; } @@ -1994,9 +1994,9 @@ void Editor::InsertCharacter(std::string_view sv) { ch = utf32[0]; } } - NotifyChar(ch); + NotifyChar(ch, charSource); - if (recordingMacro) { + if (recordingMacro && charSource != CharacterSource::tentativeInput) { std::string copy(sv); // ensure NUL-terminated NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<sptr_t>(copy.data())); } @@ -2342,10 +2342,11 @@ void Editor::NotifyErrorOccurred(Document *, void *, int status) { errorStatus = status; } -void Editor::NotifyChar(int ch) { +void Editor::NotifyChar(int ch, CharacterSource charSource) { SCNotification scn = {}; scn.nmhdr.code = SCN_CHARADDED; scn.ch = ch; + scn.characterSource = static_cast<int>(charSource); NotifyParent(scn); } @@ -3091,7 +3092,7 @@ void Editor::NewLine() { for (size_t i = 0; i < countInsertions; i++) { const char *eol = StringFromEOLMode(pdoc->eolMode); while (*eol) { - NotifyChar(*eol); + NotifyChar(*eol, CharacterSource::directInput); if (recordingMacro) { char txt[2]; txt[0] = *eol; |