| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
|
|
| |
Also added a bunch of tests to ensure correct behaviour
|
|
|
|
|
|
|
| |
* Avoid copying fragments
* Add slice / slices method
* Better documentation for fragment and slice methods
|
|
|
|
|
|
|
|
|
|
|
| |
When a new View of a Document is created, a default cursor of 0, 0 is
created, and it does not get normalized to a single width cursor until
at least one movement of the cursor happens. This appears to have no
practical negative effect that I could find, but it makes tests difficult
to work with, since the initial selection is not what you expect it to be.
This changes the initial selection of a new View to be the width of the
first grapheme in the text.
|
| |
|
|
|
| |
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* feat(commands): shrink_selection
Add `shrink_selection` command that can be used to shrink
previously expanded selection.
To make `shrink_selection` work it was necessary to add
selection history to the Document since we want to shrink
the selection towards the syntax tree node that was initially
selected.
Selection history is cleared any time the user changes
selection other way than by `expand_selection`. This ensures
that we don't get some funky edge cases when user calls
`shrink_selection`.
Related: https://github.com/helix-editor/helix/discussions/1328
* Refactor shrink_selection, move history to view
* Remove useless comment
* Add default key mapping for extend&shrink selection
* Rework contains_selection method
* Shrink selection without expand selects first child
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* feat(commands): ensure_selections_forward
Add command that ensures that selections are in forward direction.
Fixes: https://github.com/helix-editor/helix/issues/1332
* Add keybinding for ensure_selections_forward
Add `A-:` keybinding for the ensure_selections_forward command.
* Re-use range.flip for flip_selections command
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* use auto pairs with selections
Previously, the auto pairs code was converting the user selection into
its cursor form, and setting the transaction's selection to that cursor.
This has the effect of destroying the user's selection if they type a
pair character that gets auto completed.
This fixes the code to work with the user's selection, inserting auto
pairs where appropriate, but either keeping or extending the user's
selection.
* use movement::Direction instead of bool
* assume 0-width cursor is forward
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #1077. This was caused by the assumption that a block
cursor is represented as zero width internally and simply
rendered to be a single width selection, where as in reality
a block cursor is an actual single width selection in form and
function.
Behavioural changes:
1. Surround selection no longer works when cursor is _on_ a
surround character that has matching pairs (like `'`
or `"`). This was the intended behaviour from the start
but worked till now because of the cursor position
calculation mismatch.
|
| |
|
|
|
|
|
|
|
|
|
| |
* Add `remove_selections` command
* Document `remove_selections`
* Update helix-term/src/keymap.rs
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
|
|
|
|
|
|
| |
Fixes #985
Co-authored-by: Daniel S Poulin <crimsonmage+github@gmail.com>
|
|
|
|
|
|
| |
The styles are now pulled from upstream styles, some of the changes I
submitted it back to upstream.
Fix #796
|
|
|
|
|
|
| |
This allows removing search matches from the selection
Fixes #713
|
| |
|
|
|
|
| |
Rather than per-command like before.
|
| |
|
| |
|
| |
|
|
|
|
| |
Also fix a bunch of bugs related to it.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This also fixes a bug with `Selection::normalize()`, that could
result in an out-of-bounds primary index.
|
|
|
|
| |
Apparently I accidentally deleted that behavior in the cleanup.
|
|
|
|
|
| |
This had a bunch of knock-on effects that were buggy, such as bracket
match highlighting.
|
| |
|
|
|
|
|
| |
In particular, this wraps the annoying logic involved in keeping the
cursor width to 1 grapheme.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Add textobjects for word
* Add textobjects for surround characters
* Apply clippy lints
* Remove ThisWordPrevBound in favor of PrevWordEnd
It's the same as PrevWordEnd except for taking the current char
into account, so use a "flag" to capture that usecase
* Add tests for PrevWordEnd movement
* Remove ThisWord* movements
They did not preserve anchor positions and were only used
for textobject boundary search anyway so replace them with
simple position finding functions
* Rewrite tests of word textobject
* Add tests for surround textobject
* Add textobject docs
* Refactor textobject word position functions
* Apply clippy lints on textobject
* Fix overflow error with textobjects
|
| | |
|
|\| |
|
| |
| |
| |
| |
| | |
I'm not sure how to address them, because they look like they
might be bugs, and code is involved. Will poke the relevant people.
|
| |
| |
| |
| | |
Still a bunch more warnings to fix in core, but it's a start.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
This way they do less work, are more specific to what we actually
need, and they compose.
|
| | |
|
|/ |
|
|
|
|
| |
Fixes #391
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add convenience/clarity wrapper for Range initialization
* Test horizontal moves
* Add column jumping tests
* Add failing movement conditions for multi-word moves
* Refactor skip_over_next
* Add complex forward movement unit tests
* Add strict whitespace checks and edge case tests
* Restore formatting
* Remove unused function
* Add empty test case for deletion and fix nth_prev_word_boundary
* Add tests for backward motion
* Refactor word movement
* Address review comments and finish refactoring backwards move
* Finish unit test suite
* Fmt pass
* Fix lint erors
* Clean up diff restoring bad 'cargo fmt' actions
* Simplify movement closures (thanks Pickfire)
* Fmt pass
* Replace index-based movement with iterator based movement, ensuring that each move incurs a single call to the RopeSlice API
* Break down tuple function
* Extract common logic to all movement functions
* Split iterator helpers away into their own module
* WIP reducing clones
* Operate on spans
* WIP simplifying iterators
* Simplify motion helpers
* Fix iterator
* Fix all unit tests
* Refactor and simplify
* Simplify fold
|
|
|
|
|
|
|
| |
* init
* wip
* wip
|
| |
|
| |
|
| |
|