diff options
-rw-r--r-- | doc/ScintillaHistory.html | 5 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | include/ScintillaTypes.h | 1 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 23 | ||||
-rw-r--r-- | src/ScintillaBase.h | 1 |
6 files changed, 29 insertions, 3 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index b145692b5..6f37e98e1 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -592,6 +592,11 @@ SCI_GETSTYLEDTEXT which is not safe for huge documents. <a href="https://sourceforge.net/p/scintilla/feature-requests/1455/">Feature #1455</a>. </li> + <li> + Send SCN_AUTOCCOMPLETED for SCI_AUTOCSHOW + triggering insertion because of SCI_AUTOCSETCHOOSESINGLE mode. + <a href="https://sourceforge.net/p/scintilla/feature-requests/1459/">Feature #1459</a>. + </li> </ul> <h3> <a href="https://www.scintilla.org/scintilla531.zip">Release 5.3.1</a> diff --git a/include/Scintilla.h b/include/Scintilla.h index 30760431f..1baee5e49 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -1240,6 +1240,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_AC_TAB 3 #define SC_AC_NEWLINE 4 #define SC_AC_COMMAND 5 +#define SC_AC_SINGLE_CHOICE 6 #define SC_CHARACTERSOURCE_DIRECT_INPUT 0 #define SC_CHARACTERSOURCE_TENTATIVE_INPUT 1 #define SC_CHARACTERSOURCE_IME_RESULT 2 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index a527bb9a4..e65b5e5d7 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -3350,6 +3350,7 @@ val SC_AC_DOUBLECLICK=2 val SC_AC_TAB=3 val SC_AC_NEWLINE=4 val SC_AC_COMMAND=5 +val SC_AC_SINGLE_CHOICE=6 ali SC_AC_FILLUP=FILL_UP ali SC_AC_DOUBLECLICK=DOUBLE_CLICK diff --git a/include/ScintillaTypes.h b/include/ScintillaTypes.h index 5fc18b71b..4692e9916 100644 --- a/include/ScintillaTypes.h +++ b/include/ScintillaTypes.h @@ -624,6 +624,7 @@ enum class CompletionMethods { Tab = 3, Newline = 4, Command = 5, + SingleChoice = 6, }; enum class CharacterSource { diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index d47d289dd..571ffc8de 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -254,6 +254,11 @@ void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list } else { AutoCompleteInsert(sel.MainCaret(), 0, choice.substr(lenEntered)); } + const Sci::Position firstPos = sel.MainCaret() - lenEntered; + // Construct a string with a NUL at end as that is expected by applications + const std::string selected(choice); + AutoCompleteNotifyCompleted('\0', CompletionMethods::SingleChoice, firstPos, selected.c_str()); + ac.Cancel(); return; } @@ -395,6 +400,20 @@ void ScintillaBase::AutoCompleteCharacterDeleted() { NotifyParent(scn); } +void ScintillaBase::AutoCompleteNotifyCompleted(char ch, CompletionMethods completionMethod, Sci::Position firstPos, const char *text) { + NotificationData scn = {}; + scn.nmhdr.code = Notification::AutoCCompleted; + scn.message = static_cast<Message>(0); + scn.ch = ch; + scn.listCompletionMethod = completionMethod; + scn.wParam = listType; + scn.listType = listType; + scn.position = firstPos; + scn.lParam = firstPos; + scn.text = text; + NotifyParent(scn); +} + void ScintillaBase::AutoCompleteCompleted(char ch, CompletionMethods completionMethod) { const int item = ac.GetSelection(); if (item == -1) { @@ -433,9 +452,7 @@ void ScintillaBase::AutoCompleteCompleted(char ch, CompletionMethods completionM AutoCompleteInsert(firstPos, endPos - firstPos, selected); SetLastXChosen(); - scn.nmhdr.code = Notification::AutoCCompleted; - NotifyParent(scn); - + AutoCompleteNotifyCompleted(ch, completionMethod, firstPos, selected.c_str()); } int ScintillaBase::AutoCompleteGetCurrent() const { diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index 820f88daa..b8331aaf0 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -65,6 +65,7 @@ protected: int AutoCompleteGetCurrentText(char *buffer) const; void AutoCompleteCharacterAdded(char ch); void AutoCompleteCharacterDeleted(); + void AutoCompleteNotifyCompleted(char ch, CompletionMethods completionMethod, Sci::Position firstPos, const char *text); void AutoCompleteCompleted(char ch, Scintilla::CompletionMethods completionMethod); void AutoCompleteMoveToCurrentWord(); void AutoCompleteSelection(); |