diff options
author | Neil <nyamatongwe@gmail.com> | 2021-07-17 14:54:31 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-07-17 14:54:31 +1000 |
commit | ad0162453e48fb729d1793eca40ac137e1e3451e (patch) | |
tree | 158e0126b95245ca178531dcba45e4ffc5dcdde5 /src | |
parent | 9aa05526ca323258c4879520093a0fe27826d53c (diff) | |
download | scintilla-mirror-ad0162453e48fb729d1793eca40ac137e1e3451e.tar.gz |
Add SCI_AUTOCSETOPTIONS to allow choosing a non-resizeable autocompletion list
on Win32. This also avoids a header rectangle above the list.
Diffstat (limited to 'src')
-rw-r--r-- | src/AutoComplete.cxx | 4 | ||||
-rw-r--r-- | src/AutoComplete.h | 4 | ||||
-rw-r--r-- | src/Platform.h | 1 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 16 |
4 files changed, 19 insertions, 6 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index fec0f20e9..87077e92a 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -39,6 +39,7 @@ AutoComplete::AutoComplete() : typesep('?'), ignoreCase(false), chooseSingle(false), + options(AutoCompleteOption::Normal), posStart(0), startLen(0), cancelAtStartPos(true), @@ -63,10 +64,11 @@ bool AutoComplete::Active() const noexcept { void AutoComplete::Start(Window &parent, int ctrlID, Sci::Position position, Point location, Sci::Position startLen_, - int lineHeight, bool unicodeMode, Technology technology) { + int lineHeight, bool unicodeMode, Technology technology, ListOptions listOptions) { if (active) { Cancel(); } + lb->SetOptions(listOptions); lb->Create(parent, ctrlID, location, lineHeight, unicodeMode, technology); lb->Clear(); active = true; diff --git a/src/AutoComplete.h b/src/AutoComplete.h index c46530771..fa8f57287 100644 --- a/src/AutoComplete.h +++ b/src/AutoComplete.h @@ -25,6 +25,7 @@ public: bool ignoreCase; bool chooseSingle; + AutoCompleteOption options; std::unique_ptr<ListBox> lb; Sci::Position posStart; Sci::Position startLen; @@ -49,7 +50,8 @@ public: /// Display the auto completion list positioned to be near a character position void Start(Window &parent, int ctrlID, Sci::Position position, Point location, - Sci::Position startLen_, int lineHeight, bool unicodeMode, Scintilla::Technology technology); + Sci::Position startLen_, int lineHeight, bool unicodeMode, Scintilla::Technology technology, + ListOptions listOptions); /// The stop chars are characters which, when typed, cause the auto completion list to disappear void SetStopChars(const char *stopChars_); diff --git a/src/Platform.h b/src/Platform.h index 10c63dd23..ce04d9b22 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -313,6 +313,7 @@ struct ListOptions { std::optional<ColourRGBA> back; std::optional<ColourRGBA> foreSelected; std::optional<ColourRGBA> backSelected; + AutoCompleteOption options=AutoCompleteOption::Normal; }; class ListBox : public Window { diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 0adca2f6f..238299734 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -257,16 +257,17 @@ void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list return; } } - ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(), - lenEntered, vs.lineHeight, IsUnicodeMode(), technology); ListOptions options{ vs.ElementColour(Element::List), vs.ElementColour(Element::ListBack), vs.ElementColour(Element::ListSelected), - vs.ElementColour(Element::ListSelectedBack) + vs.ElementColour(Element::ListSelectedBack), + ac.options, }; - ac.lb->SetOptions(options); + + ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(), + lenEntered, vs.lineHeight, IsUnicodeMode(), technology, options); const PRectangle rcClient = GetClientRectangle(); Point pt = LocationFromPosition(sel.MainCaret() - lenEntered); @@ -942,6 +943,13 @@ sptr_t ScintillaBase::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::AutoCGetAutoHide: return ac.autoHide; + case Message::AutoCSetOptions: + ac.options = static_cast<AutoCompleteOption>(wParam); + break; + + case Message::AutoCGetOptions: + return static_cast<sptr_t>(ac.options); + case Message::AutoCSetDropRestOfWord: ac.dropRestOfWord = wParam != 0; break; |