aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorTheBlob42 <hessenmobbel@web.de>2025-08-03 21:52:09 +0200
committerGitHub <noreply@github.com>2025-08-03 19:52:09 +0000
commitecded994c17344d0428bffe2a1774522164eb06f (patch)
treed5f09d8ac92a13e4b911a90cc1687c04d3c5935b /runtime/lua/vim
parent7ed8cbd095805b9e6079def91b13ec24ecec5348 (diff)
downloadrneovim-ecded994c17344d0428bffe2a1774522164eb06f.tar.gz
rneovim-ecded994c17344d0428bffe2a1774522164eb06f.tar.bz2
rneovim-ecded994c17344d0428bffe2a1774522164eb06f.zip
fix(snippet): early return for final tabstop #35115
The cursor movement autocommand can not detect when the final tabstop $0 is directly adjacent to another tabstop, which prevents ending the snippet session. The fix is an early return when jumping.
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/snippet.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/lua/vim/snippet.lua b/runtime/lua/vim/snippet.lua
index 33c3e11e3d..f271265c18 100644
--- a/runtime/lua/vim/snippet.lua
+++ b/runtime/lua/vim/snippet.lua
@@ -585,6 +585,12 @@ function M.jump(direction)
M._session.current_tabstop = dest
select_tabstop(dest)
+ -- The cursor is not on a tabstop so exit the session.
+ if dest.index == 0 then
+ M.stop()
+ return
+ end
+
-- Activate expansion of the destination tabstop.
M._session:set_group_gravity(dest.index, false)