aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2022-10-20 10:42:56 +1100
committerNeil <nyamatongwe@gmail.com>2022-10-20 10:42:56 +1100
commit758ee3666b0ee5b1adc91c269ec845f9db6f8dea (patch)
tree1e00fe5d9c3871ebd8ecfc2d8547538766376999 /src
parentbb1cd6ce1a5f0a8ea1a31d37c0500c6a4edb1372 (diff)
downloadscintilla-mirror-758ee3666b0ee5b1adc91c269ec845f9db6f8dea.tar.gz
Feature [feature-requests:#1459] Send SCN_AUTOCCOMPLETED for SCI_AUTOCSHOW
triggering insertion because of SCI_AUTOCSETCHOOSESINGLE mode.
Diffstat (limited to 'src')
-rw-r--r--src/ScintillaBase.cxx23
-rw-r--r--src/ScintillaBase.h1
2 files changed, 21 insertions, 3 deletions
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();