aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/editing.lua12
-rw-r--r--modules/textadept/keys.lua2
-rw-r--r--modules/textadept/menu.lua2
3 files changed, 6 insertions, 10 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index cd62314b..9345743d 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -221,30 +221,26 @@ end
-- Displays an autocompletion list, built from the set of *default_words* and
-- existing words in the buffer, for the word behind the caret, returning `true`
-- if completions were found.
--- *word_chars* contains a set of word characters.
--- @param word_chars String of characters considered to be part of words. Since
--- this string is used in a Lua pattern character set, character classes and
--- ranges may be used.
-- @param default_words Optional list of words considered to be in the buffer,
-- even if they are not. Words may contain [registered images][].
--
-- [registered images]: buffer.html#register_image
-- @return `true` if there were completions to show; `false` otherwise.
--- @usage _M.textadept.editing.autocomplete_word('%w_')
+-- @see buffer.word_chars
-- @name autocomplete_word
-function M.autocomplete_word(word_chars, default_words)
+function M.autocomplete_word(default_words)
local buffer = buffer
local pos, length = buffer.current_pos, buffer.length
local completions, c_list = {}, {}
local buffer_text = buffer:get_text(buffer.length)
- local root = buffer_text:sub(1, pos):match('['..word_chars..']+$')
+ local root = buffer_text:sub(1, pos):match('['..buffer.word_chars..']+$')
if not root or root == '' then return end
for _, word in ipairs(default_words or {}) do
if word:match('^'..root) then
c_list[#c_list + 1], completions[word:match('^(.-)%??%d*$')] = word, true
end
end
- local patt = '^['..word_chars..']+'
+ local patt = '^['..buffer.word_chars..']+'
buffer.target_start, buffer.target_end = 0, buffer.length
buffer.search_flags = _SCINTILLA.constants.SCFIND_WORDSTART
if not buffer.auto_c_ignore_case then
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index b2633783..d8b48ff2 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -390,7 +390,7 @@ keys[not OSX and (not CURSES and 'adel' or 'mdel')
keys[not OSX and not CURSES and 'ca' or 'ma'] = buffer.select_all
keys[not CURSES and 'cm' or 'mm'] = m_editing.match_brace
keys[not OSX and (not CURSES and 'c\n' or 'cmj')
- or 'cesc'] = {m_editing.autocomplete_word, '%w_'}
+ or 'cesc'] = m_editing.autocomplete_word
if CURSES and WIN32 then keys['c\r'] = keys['cmj'] end
if not CURSES then
keys[not OSX and 'caH' or 'mH'] = m_editing.highlight_word
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 86bbc5ae..1db09d69 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -66,7 +66,7 @@ M.menubar = {
{_L['Select _All'], buffer.select_all},
SEPARATOR,
{_L['_Match Brace'], m_editing.match_brace},
- {_L['Complete _Word'], {m_editing.autocomplete_word, '%w_'}},
+ {_L['Complete _Word'], m_editing.autocomplete_word},
{_L['_Highlight Word'], m_editing.highlight_word},
{_L['Toggle _Block Comment'], m_editing.block_comment},
{_L['T_ranspose Characters'], m_editing.transpose_chars},