diff options
author | nyamatongwe <devnull@localhost> | 2012-04-16 09:05:21 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2012-04-16 09:05:21 +1000 |
commit | 817b02c3e3a6d82d6f19f77f15f795a072a82a4c (patch) | |
tree | f8bbcc7e265ba307903877ca063c5bee8220682d | |
parent | dac7fe49689a2edbd42a9b5fed10a94ea05969fc (diff) | |
download | scintilla-mirror-817b02c3e3a6d82d6f19f77f15f795a072a82a4c.tar.gz |
Case-insensitive auto-completion selection. Bug #3516538.
From Markus Nißl.
-rw-r--r-- | doc/ScintillaDoc.html | 9 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 1 | ||||
-rw-r--r-- | include/Scintilla.h | 4 | ||||
-rw-r--r-- | include/Scintilla.iface | 10 | ||||
-rw-r--r-- | src/AutoComplete.cxx | 7 | ||||
-rw-r--r-- | src/AutoComplete.h | 1 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 7 |
7 files changed, 37 insertions, 2 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 2536b36c6..87c71d158 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3931,6 +3931,8 @@ struct Sci_TextToFind { <a class="message" href="#SCI_AUTOCSETIGNORECASE">SCI_AUTOCSETIGNORECASE(bool ignoreCase)</a><br /> <a class="message" href="#SCI_AUTOCGETIGNORECASE">SCI_AUTOCGETIGNORECASE</a><br /> + <a class="message" href="#SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</a><br> + <a class="message" href="#SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</a><br> <a class="message" href="#SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</a><br /> <a class="message" href="#SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</a><br /> <a class="message" href="#SCI_AUTOCSETDROPRESTOFWORD">SCI_AUTOCSETDROPRESTOFWORD(bool @@ -4036,6 +4038,13 @@ struct Sci_TextToFind { By default, matching of characters to list members is case sensitive. These messages let you set and get case sensitivity.</p> + <p><b id="SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR(int behaviour)</b><br> + <b id="SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR">SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR</b><br> + When autocompletion is set to ignore case (<code>SCI_AUTOCSETIGNORECASE</code>), by default it will + nonetheless select the first list member that matches in a case sensitive way to entered characters. + This corresponds to a behaviour property of <code>AC_SELECT_CI_RESPECT_CS</code> (0). + If you want autocompletion to ignore case at all, choose <code>AC_SELECT_CI_IGNORE_CS</code> (1).</p> + <p><b id="SCI_AUTOCSETAUTOHIDE">SCI_AUTOCSETAUTOHIDE(bool autoHide)</b><br /> <b id="SCI_AUTOCGETAUTOHIDE">SCI_AUTOCGETAUTOHIDE</b><br /> By default, the list is cancelled if there are no viable matches (the user has typed diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index b6df6ac94..8276a7b68 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -398,6 +398,7 @@ </tr><tr> <td>zeniko</td> <td>James Ribe</td> + <td>Markus Nißl</td> </tr> </table> <p> diff --git a/include/Scintilla.h b/include/Scintilla.h index 7a6f58fac..8ff3d3142 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -685,6 +685,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETCHARSDEFAULT 2444 #define SCI_AUTOCGETCURRENT 2445 #define SCI_AUTOCGETCURRENTTEXT 2610 +#define SC_CASEINSENSITITIVEBEHAVIOUR_RESPECTCASE 0 +#define SC_CASEINSENSITITIVEBEHAVIOUR_IGNORECASE 1 +#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634 +#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635 #define SCI_ALLOCATE 2446 #define SCI_TARGETASUTF8 2447 #define SCI_SETLENGTHFORENCODE 2448 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index a2a38d51c..e34f79dad 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1806,6 +1806,16 @@ fun int AutoCGetCurrent=2445(,) # Returns the length of the item text fun int AutoCGetCurrentText=2610(, stringresult s) +enu CaseInsensititiveBehaviour=SC_CASEINSENSITITIVEBEHAVIOUR_ +val SC_CASEINSENSITITIVEBEHAVIOUR_RESPECTCASE=0 +val SC_CASEINSENSITITIVEBEHAVIOUR_IGNORECASE=1 + +# Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. +set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,) + +# Get auto-completion case insensitive behaviour. +get int AutoCGetCaseInsensitiveBehaviour=2635(,) + # Enlarge the document to a particular size of text bytes. fun void Allocate=2446(int bytes,) diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index 2752ef0c9..644f16517 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -14,6 +14,7 @@ #include "CharacterSet.h" #include "AutoComplete.h" +#include "Scintilla.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -30,7 +31,8 @@ AutoComplete::AutoComplete() : startLen(0), cancelAtStartPos(true), autoHide(true), - dropRestOfWord(false) { + dropRestOfWord(false), + ignoreCaseBehaviour(SC_CASEINSENSITITIVEBEHAVIOUR_RESPECTCASE) { lb = ListBox::Allocate(); stopChars[0] = '\0'; fillUpChars[0] = '\0'; @@ -153,7 +155,8 @@ void AutoComplete::Select(const char *word) { --pivot; } location = pivot; - if (ignoreCase) { + if (ignoreCase + && ignoreCaseBehaviour == SC_CASEINSENSITITIVEBEHAVIOUR_RESPECTCASE) { // Check for exact-case match for (; pivot <= end; pivot++) { lb->GetValue(pivot, item, maxItemLen); diff --git a/src/AutoComplete.h b/src/AutoComplete.h index aefab120a..19a1271ac 100644 --- a/src/AutoComplete.h +++ b/src/AutoComplete.h @@ -31,6 +31,7 @@ public: bool cancelAtStartPos; bool autoHide; bool dropRestOfWord; + unsigned int ignoreCaseBehaviour; AutoComplete(); ~AutoComplete(); diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index f78d0fb96..9d4f93c3f 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -727,6 +727,13 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_AUTOCGETIGNORECASE: return ac.ignoreCase; + case SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR: + ac.ignoreCaseBehaviour = wParam; + break; + + case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR: + return ac.ignoreCaseBehaviour; + case SCI_USERLISTSHOW: listType = wParam; AutoCompleteStart(0, reinterpret_cast<const char *>(lParam)); |