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({