Fix usage of string.sub (#1164)

From https://www.lua.org/pil/20.html

> The call string.sub(s,i,j) extracts a piece of the string s, from the i-th to the j-th character inclusive.

This was breaking textobjects movement.
This commit is contained in:
Santos Gallegos 2021-04-07 19:23:14 -05:00 committed by GitHub
parent fe5fd3d79c
commit 5f53f55371
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -169,7 +169,7 @@ end
-- Works like M.get_references or M.get_scopes except you can choose the capture
-- Can also be a nested capture like @definition.function to get all nodes defining a function
function M.get_capture_matches(bufnr, capture_string, query_group, root, lang)
if not string.sub(capture_string, 1,2) == '@' then
if not string.sub(capture_string, 1, 1) == '@' then
print('capture_string must start with "@"')
return
end
@ -189,7 +189,7 @@ function M.get_capture_matches(bufnr, capture_string, query_group, root, lang)
end
function M.find_best_match(bufnr, capture_string, query_group, filter_predicate, scoring_function, root)
if string.sub(capture_string, 1,2) == '@' then
if string.sub(capture_string, 1, 1) == '@' then
--remove leading "@"
capture_string = string.sub(capture_string, 2)
end