1
0
mirror of https://github.com/helix-editor/helix synced 2024-11-10 10:34:45 +01:00
helix/helix-term
Gabriel Hansson c1488267e5
(Updated) Apply motion API refinements (#6078)
* _apply_motion generalization where possible

API encourages users to not forget setting `editor.last_motion` when
applying a motion. But also not setting `last_motion` without applying a
motion first.

* (rename) will_find_char -> find_char

method name makes it sound like it would be returning a boolean.

* use _apply_motion in find_char

Feature that falls out from this is that repetitions of t,T,f,F are
saved with the context extention/move and count. (Not defaulting to extend
by 1 count).

* Finalize apply_motion API

last_motion is now a private field and can only be set by calling
Editor.apply_motion(). Removing need (and possibility) of writing:

`motion(editor); editor.last_motion = motion`

Now it's just: `editor.apply_motion(motion)`

* editor.last_message: rm Box wrap around Arc

* Use pre-existing `Direction` rather than custom `SearchDirection`.

* `LastMotion` type alias for `Option<Arc<dyn Fn(&mut Editor)>>`

* Take motion rather than cloning it.

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* last_motion as Option<Motion>.

* Use `Box` over `Arc` for `last_motion`.

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-07-09 16:50:24 -04:00
..
src (Updated) Apply motion API refinements (#6078) 2023-07-09 16:50:24 -04:00
tests Add config for default line ending (#5621) 2023-06-16 12:02:15 -05:00
.gitignore
build.rs
Cargo.toml build(deps): bump indoc from 2.0.1 to 2.0.2 (#7529) 2023-07-04 02:13:58 +02:00