diff options
author | nyamatongwe <unknown> | 2001-04-27 12:41:50 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2001-04-27 12:41:50 +0000 |
commit | 47c3e67c26e19f237bab42d3a98019add82bb4b5 (patch) | |
tree | 5a17afae1b3e4d7fd6770f78a5b818ec55cc0997 | |
parent | 9701edb696cc54ae66f1e10fb6e946df1426f71a (diff) | |
download | scintilla-mirror-47c3e67c26e19f237bab42d3a98019add82bb4b5.tar.gz |
Feature from Stephan to allow autocompletion to stay open even when there
are no longer any values that start with the typed text.
-rw-r--r-- | include/Scintilla.h | 2 | ||||
-rw-r--r-- | include/Scintilla.iface | 6 | ||||
-rw-r--r-- | src/AutoComplete.cxx | 5 | ||||
-rw-r--r-- | src/AutoComplete.h | 17 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 8 |
5 files changed, 28 insertions, 10 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index efead567a..b1de42cee 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -199,6 +199,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_AUTOCSETIGNORECASE 2115 #define SCI_AUTOCGETIGNORECASE 2116 #define SCI_USERLISTSHOW 2117 +#define SCI_AUTOCSETAUTOHIDE 2118 +#define SCI_AUTOCGETAUTOHIDE 2119 #define SCI_SETINDENT 2122 #define SCI_GETINDENT 2123 #define SCI_SETUSETABS 2124 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 3a0fa61f9..6764edfe2 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -479,6 +479,12 @@ get bool AutoCGetIgnoreCase=2116(,) # Display a list of strings and send notification when user chooses one. fun void UserListShow=2117(int listType, string itemList) +# Set whether or not autocompletion is hidden automatically when nothing matches +set void AutoCSetAutoHide=2118(bool autoHide,) + +# Retrieve whether or not autocompletion is hidden automatically when nothing matches +get bool AutoCGetAutoHide=2119(,) + # Set the number of spaces used for one level of indentation. set void SetIndent=2122(int indentSize,) 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()) { |