aboutsummaryrefslogtreecommitdiff
path: root/modules/ansi_c
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-03-30 18:44:15 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2020-03-30 18:44:15 -0400
commitc46527cc32aef6fd332ea5e45757c0858b1cbb5d (patch)
tree8ffd94daf08117a21469697c4cec2c14a5bfdeb3 /modules/ansi_c
parent4d88d116f8f8181186fd734841d5303269924c16 (diff)
downloadtextadept-c46527cc32aef6fd332ea5e45757c0858b1cbb5d.tar.gz
textadept-c46527cc32aef6fd332ea5e45757c0858b1cbb5d.zip
Fixed off-by-one issues with `buffer:get_cur_line()`.
Diffstat (limited to 'modules/ansi_c')
-rw-r--r--modules/ansi_c/init.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/ansi_c/init.lua b/modules/ansi_c/init.lua
index 688b81c3..8cfc5135 100644
--- a/modules/ansi_c/init.lua
+++ b/modules/ansi_c/init.lua
@@ -35,7 +35,8 @@ local xpms = setmetatable({
textadept.editing.autocompleters.ansi_c = function()
-- Retrieve the symbol behind the caret.
local line, pos = buffer:get_cur_line()
- local symbol, op, part = line:sub(1, pos):match('([%w_]-)([%.%->]*)([%w_]*)$')
+ local symbol, op, part = line:sub(1, pos - 1):match(
+ '([%w_]-)([%.%->]*)([%w_]*)$')
if symbol == '' and part == '' then return nil end -- nothing to complete
if op ~= '' and op ~= '.' and op ~= '->' then return nil end
-- Attempt to identify the symbol type.