From eb9556dd931b374aba76db885e4dc56f0fa54c87 Mon Sep 17 00:00:00 2001 From: Saket Patel Date: Mon, 2 Oct 2023 20:57:44 +0530 Subject: [PATCH] fix(motion): ignores @ and other reader macros as form's edge --- lua/nvim-paredit/api/motions.lua | 2 +- tests/nvim-paredit/motion_spec.lua | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lua/nvim-paredit/api/motions.lua b/lua/nvim-paredit/api/motions.lua index d42afe7..e24ee1f 100644 --- a/lua/nvim-paredit/api/motions.lua +++ b/lua/nvim-paredit/api/motions.lua @@ -169,7 +169,7 @@ local function move_to_parent_form_edge(direction) local form_node_to_move_to = nearest_form_node while is_cursor_at_form_edge(form_node_to_move_to, direction, cur_cursor_pos, lang) do - form_node_to_move_to = form_node_to_move_to:parent() + form_node_to_move_to = lang.get_node_root(form_node_to_move_to):parent() if not form_node_to_move_to or form_node_to_move_to:type() == "source" then return end diff --git a/tests/nvim-paredit/motion_spec.lua b/tests/nvim-paredit/motion_spec.lua index 2b0aa92..7541684 100644 --- a/tests/nvim-paredit/motion_spec.lua +++ b/tests/nvim-paredit/motion_spec.lua @@ -269,12 +269,6 @@ describe("motions", function() cursor = { 1, 10 }, }) - -- (aa (bb) |@(cc) #{1}) - internal_api.move_to_parent_form_start() - expect({ - cursor = { 1, 9 }, - }) - -- |(aa (bb) @(cc) #{1}) internal_api.move_to_parent_form_start() expect({