diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/AutoComplete.cxx | 18 | ||||
-rw-r--r-- | src/AutoComplete.h | 1 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 30 |
3 files changed, 41 insertions, 8 deletions
diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index 6866364c1..5bc50d1ef 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -10,14 +10,16 @@ #include "AutoComplete.h" -AutoComplete::AutoComplete() { - active = false; - posStart = 0; - strcpy(stopChars, ""); - strcpy(fillUpChars, ""); - separator = ' '; - ignoreCase = false; - cancelAtStartPos = true; +AutoComplete::AutoComplete() : + active(false), + separator(' '), + ignoreCase(false), + chooseSingle(false), + posStart(0), + startLen(0), + cancelAtStartPos(true) { + stopChars[0] = '\0'; + fillUpChars[0] = '\0'; } AutoComplete::~AutoComplete() { diff --git a/src/AutoComplete.h b/src/AutoComplete.h index 434679f93..c1789ad7b 100644 --- a/src/AutoComplete.h +++ b/src/AutoComplete.h @@ -13,6 +13,7 @@ class AutoComplete { char separator; public: bool ignoreCase; + bool chooseSingle; ListBox lb; int posStart; int startLen; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index bf81887f2..70e890e1a 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -171,6 +171,22 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { //Platform::DebugPrintf("AutoComplete %s\n", list); ct.CallTipCancel(); + if (ac.chooseSingle) { + if (list && !strchr(list, ac.GetSeparator())) { + if (ac.ignoreCase) { + SetEmptySelection(currentPos - lenEntered); + pdoc->DeleteChars(currentPos, lenEntered); + SetEmptySelection(currentPos); + pdoc->InsertString(currentPos, list); + SetEmptySelection(currentPos + strlen(list)); + } else { + SetEmptySelection(currentPos); + pdoc->InsertString(currentPos, list + lenEntered); + SetEmptySelection(currentPos + strlen(list + lenEntered)); + } + return; + } + } ac.Start(wDraw, idAutoComplete, currentPos, lenEntered); PRectangle rcClient = GetClientRectangle(); @@ -396,6 +412,20 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP ac.SetFillUpChars(reinterpret_cast<char *>(lParam)); break; + case SCI_AUTOCSETCHOOSESINGLE: + ac.chooseSingle = wParam; + break; + + case SCI_AUTOCGETCHOOSESINGLE: + return ac.chooseSingle; + + case SCI_AUTOCSETIGNORECASE: + ac.ignoreCase = wParam; + break; + + case SCI_AUTOCGETIGNORECASE: + return ac.ignoreCase; + case SCI_CALLTIPSHOW: { AutoCompleteCancel(); if (!ct.wCallTip.Created()) { |