aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/adeptsense.lua6
-rw-r--r--modules/textadept/editing.lua13
2 files changed, 15 insertions, 4 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index e414bd73..408b3069 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -479,7 +479,11 @@ function get_completions(sense, symbol, only_fields, only_functions)
add_inherited(sense, class, only_fields, only_functions, c, {})
-- Remove duplicates and non-toplevel classes (if necessary).
- table.sort(c)
+ if not buffer.auto_c_ignore_case then
+ table.sort(c)
+ else
+ table.sort(c, function(a, b) return a:upper() < b:upper() end)
+ end
local table_remove, nwc = table.remove, '[^'..sense.syntax.word_chars..'%?]'
for i = #c, 2, -1 do
if c[i] == c[i - 1] or c[i]:find(nwc) then table_remove(c, i) end
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 6c87951e..bb859b7e 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -189,8 +189,11 @@ function autocomplete_word(word_chars)
if not root or root == '' then return end
local patt = '^['..word_chars..']+'
buffer.target_start, buffer.target_end = 0, buffer.length
- buffer.search_flags = _SCINTILLA.constants.SCFIND_WORDSTART +
- _SCINTILLA.constants.SCFIND_MATCHCASE
+ buffer.search_flags = _SCINTILLA.constants.SCFIND_WORDSTART
+ if not buffer.auto_c_ignore_case then
+ buffer.search_flags = buffer.search_flags +
+ _SCINTILLA.constants.SCFIND_MATCHCASE
+ end
local match_pos = buffer:search_in_target(root)
while match_pos ~= -1 do
local s, e = buffer_text:find(patt, match_pos + 1)
@@ -202,7 +205,11 @@ function autocomplete_word(word_chars)
buffer.target_start, buffer.target_end = match_pos + 1, buffer.length
match_pos = buffer:search_in_target(root)
end
- table.sort(c_list)
+ if not buffer.auto_c_ignore_case then
+ table.sort(c_list)
+ else
+ table.sort(c_list, function(a, b) return a:upper() < b:upper() end)
+ end
if #c_list > 0 then
if not buffer.auto_c_choose_single or #c_list ~= 1 then
buffer:auto_c_show(#root, table.concat(c_list, ' '))