diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/AutoComplete.cxx | 5 | ||||
-rw-r--r-- | src/AutoComplete.h | 17 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 8 |
3 files changed, 20 insertions, 10 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index 81eb12d99..676a4124d 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -19,7 +19,8 @@ AutoComplete::AutoComplete() : chooseSingle(false), posStart(0), startLen(0), - cancelAtStartPos(true) { + cancelAtStartPos(true), + autoHide(true) { stopChars[0] = '\0'; fillUpChars[0] = '\0'; } @@ -117,7 +118,7 @@ void AutoComplete::Move(int delta) { void AutoComplete::Select(const char *word) { int pos = lb.Find(word); //Platform::DebugPrintf("Autocompleting at <%s> %d\n", wordCurrent, pos); - if (pos == -1) + if (pos == -1 && autoHide) Cancel(); else lb.Select(pos); diff --git a/src/AutoComplete.h b/src/AutoComplete.h index 294b58bd6..79d467529 100644 --- a/src/AutoComplete.h +++ b/src/AutoComplete.h @@ -24,20 +24,21 @@ public: int startLen; /// Should autocompletion be canceled if editor's currentPos <= startPos? bool cancelAtStartPos; - + bool autoHide; + AutoComplete(); ~AutoComplete(); /// Is the auto completion list displayed? bool Active(); - + /// Display the auto completion list positioned to be near a character position void Start(Window &parent, int ctrlID, int position, int startLen_); - + /// The stop chars are characters which, when typed, cause the auto completion list to disappear void SetStopChars(const char *stopChars_); bool IsStopChar(char ch); - + /// The fillup chars are characters which, when typed, fill up the selected word void SetFillUpChars(const char *fillUpChars_); bool IsFillUpChar(char ch); @@ -45,16 +46,16 @@ public: /// The separator character is used when interpreting the list in SetList void SetSeparator(char separator_); char GetSeparator(); - + /// The list string contains a sequence of words separated by the separator character void SetList(const char *list); - + void Show(); void Cancel(); - + /// Move the current list element by delta, scrolling appropriately void Move(int delta); - + /// Select a list element that starts with word as the current element void Select(const char *word); }; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index ad2e97c90..fe873b0f2 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -459,6 +459,14 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara AutoCompleteStart(0, reinterpret_cast<const char *>(lParam)); break; + case SCI_AUTOCSETAUTOHIDE: + ac.autoHide = wParam; + break; + + case SCI_AUTOCGETAUTOHIDE: + return ac.autoHide; + break; + case SCI_CALLTIPSHOW: { AutoCompleteCancel(); if (!ct.wCallTip.Created()) { |