diff options
-rw-r--r-- | core/.buffer.luadoc | 3 | ||||
-rw-r--r-- | core/init.lua | 10 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 8 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 2 |
4 files changed, 7 insertions, 16 deletions
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc index 49e4309b..a028beb9 100644 --- a/core/.buffer.luadoc +++ b/core/.buffer.luadoc @@ -1437,8 +1437,9 @@ function brace_highlight_indicator(buffer, use_indicator, indicator) end -- '>' and must have the same style. -- @param buffer A buffer. -- @param pos The position of the brace in *buffer* to match. +-- @param max_re_style Must be `0`. Reserved for expansion. -- @return number -function brace_match(buffer, pos) end +function brace_match(buffer, pos, max_re_style) end --- -- Returns whether or not a call tip is visible. diff --git a/core/init.lua b/core/init.lua index 327068f3..bcecd2e8 100644 --- a/core/init.lua +++ b/core/init.lua @@ -56,16 +56,6 @@ local function text_range(buffer, start_pos, end_pos) end events.connect(events.BUFFER_NEW, function() buffer.text_range = text_range end) -local _brace_match --- Compatibility function for Scintilla's current `buffer:brace_match()`, which --- has an extra, required `0` parameter (introduced in 3.7.0). --- Documentation is in core/.buffer.luadoc. -local function brace_match(buffer, pos) return _brace_match(buffer, pos, 0) end -events.connect(events.BUFFER_NEW, function() - if not _brace_match then _brace_match = buffer.brace_match end - buffer.brace_match = brace_match -end) - --[[ This comment is for LuaDoc. --- -- Extends Lua's _G table to provide extra functions and fields for Textadept. diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 365a53cd..193bf78a 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -149,7 +149,7 @@ end) events.connect(events.UPDATE_UI, function(updated) if updated and bit32.band(updated, 3) == 0 then return end -- ignore scrolling if M.brace_matches[buffer.char_at[buffer.current_pos]] then - local match = buffer:brace_match(buffer.current_pos) + local match = buffer:brace_match(buffer.current_pos, 0) if match ~= -1 then buffer:brace_highlight(buffer.current_pos, match) else @@ -427,8 +427,8 @@ function M.select_enclosed(left, right) local match = M.auto_pairs[char_at[s]] left, right = string.char(char_at[s]), match if match then - if buffer:brace_match(s) >= buffer.selection_end - 1 then - e = buffer:brace_match(s) + if buffer:brace_match(s, 0) >= buffer.selection_end - 1 then + e = buffer:brace_match(s, 0) break elseif M.brace_matches[char_at[s]] or style_at[s] == style_at[buffer.selection_start] then @@ -688,7 +688,7 @@ function M.show_documentation() -- that function as well. local char_at = buffer.char_at while s >= 0 and char_at[s] ~= 40 do s = s - 1 end - e = buffer:brace_match(s) + e = buffer:brace_match(s, 0) if s > 0 and (e == -1 or e >= buffer.current_pos) then s, e = buffer:word_start_position(s - 1, true), s - 1 symbol = buffer:text_range(s, e + 1) diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index 672ddfa9..9b67eb7e 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -91,7 +91,7 @@ local default_menubar = { {_L['Select _All'], buffer.select_all}, SEPARATOR, {_L['_Match Brace'], function() - local match_pos = buffer:brace_match(buffer.current_pos) + local match_pos = buffer:brace_match(buffer.current_pos, 0) if match_pos >= 0 then buffer:goto_pos(match_pos) end end}, {_L['Complete _Word'], function() |