Skip to content

Commit 3838cb3

Browse files
conditions.show.line_end: simply compare strings
this is fast enough due to luas behaviour of interning strings (-> simple check if pointers are equal)
1 parent 4435518 commit 3838cb3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lua/luasnip/extras/conditions/show.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ local M = {}
66
-----------------------
77
local function line_end(line_to_cursor)
88
local line = vim.api.nvim_get_current_line()
9-
return #line_to_cursor == #line
9+
-- looks pretty inefficient, but as lue interns strings, this is just a
10+
-- comparision of pointers (which probably is faster than calculate the
11+
-- length and then checking)
12+
return line_to_cursor == line
1013
end
1114
M.line_end = cond_obj.make_condition(line_end)
1215

0 commit comments

Comments
 (0)