diff options
author | mitchell <unknown> | 2019-07-11 14:12:28 -0400 |
---|---|---|
committer | mitchell <unknown> | 2019-07-11 14:12:28 -0400 |
commit | 2a15b94200abe8ee0df2dddc296f3dafd55655f8 (patch) | |
tree | 7236773c70225185fe1532d109a66f98c39e8d18 /src/Editor.cxx | |
parent | 55446b8967ed0a7f66502424d309f0b8fa74919f (diff) | |
download | scintilla-mirror-2a15b94200abe8ee0df2dddc296f3dafd55655f8.tar.gz |
Backport: 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.
Backport of changeset 7613:4cfac35c71bd.
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 e963ba339..4cceb1f5d 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1888,7 +1888,7 @@ void Editor::AddChar(char ch) { char s[2]; s[0] = ch; s[1] = '\0'; - InsertCharacter(s, 1); + InsertCharacter(s, 1, CharacterSource::directInput); } void Editor::FilterSelections() { @@ -1899,7 +1899,7 @@ void Editor::FilterSelections() { } // InsertCharacter inserts a character encoded in document code page. -void Editor::InsertCharacter(const char *s, unsigned int len) { +void Editor::InsertCharacter(const char *s, unsigned int len, CharacterSource charSource) { if (len == 0) { return; } @@ -1991,9 +1991,9 @@ void Editor::InsertCharacter(const char *s, unsigned int len) { ch = utf32[0]; } } - NotifyChar(ch); + NotifyChar(ch, charSource); - if (recordingMacro) { + if (recordingMacro && charSource != CharacterSource::tentativeInput) { std::string copy(s, len); // ensure NUL-terminated NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<sptr_t>(copy.data())); } @@ -2339,10 +2339,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); } @@ -3088,7 +3089,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; |