From 274f2ea45979098a96b7a6d94ecc18351826eaea Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sat, 30 Jul 2022 09:20:07 -0500 Subject: Use requested direction for new textobject selection range This changes the behavior of operations like `]f`/`[f` to set the direction of the new range to the direction of the action. The original behavior was to always use the head of the next function. This is inconsistent with the behavior of goto_next_paragraph and makes it impossible to create extend variants of the textobject motions. This causes a behavior change when there are nested functions. The behavior in the parent commit is that repeated uses of `]f` will select every function in the file even if nested. With this commit, functions are skipped. It's notable that it's possible to emulate the original behavior by using the `ensure_selections_forward` (A-:) command between invocations of `]f`. --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 0a192b4a..53a34c00 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4294,6 +4294,7 @@ fn goto_ts_object_impl(cx: &mut Context, object: &'static str, direction: Direct lang_config, count, ) + .with_direction(direction) }); doc.set_selection(view.id, selection); -- cgit v1.2.3-70-g09d2