ath3
6fa76d9fe7
Add trim_selections command ( #1092 )
3 years ago
Ivan Tham
3eb829e233
Ensure coords in screen depends on char width ( #885 )
...
The issue affected files with lots of tabs at the start as well.
Fix #840
3 years ago
Nathan Vegdahl
3fda350494
Fixes for new clippy lints in Rust 1.54.
3 years ago
Nathan Vegdahl
aead4e69a6
Minor cleanup of the vertical movement code.
3 years ago
Nathan Vegdahl
84f8167fd1
Use `match` for branching on the `Direction` enum in more places.
3 years ago
Nathan Vegdahl
0883b4fae0
Collect some common patterns into methods on `Range`.
3 years ago
Nathan Vegdahl
f96b8b769b
Switch to a cleaner range-head moving abstraction.
...
Also fix a bunch of bugs related to it.
3 years ago
Nathan Vegdahl
fd684ef693
Revert display-width-based vertical cursor movement.
...
Still needs to be done, but should be part of a separate PR.
3 years ago
Nathan Vegdahl
c848ed7abc
Fixes for misc bugs with view movement.
3 years ago
Nathan Vegdahl
e98d669c30
Handle edge case in `range_to_target()` correctly.
3 years ago
Nathan Vegdahl
6c038bb015
Update word selection/navigation to work with gap indexing.
...
Also tweaked some of the existing behavior that seemed inconsistent
and/or buggy. It's mostly identical, just a few corner cases are
different.
3 years ago
Nathan Vegdahl
b4c59b444c
Update surround commands to work with gap indexing.
3 years ago
Nathan Vegdahl
753f7f381b
Implement `Range::put()` which manages range movements and extensions.
...
In particular, this wraps the annoying logic involved in keeping the
cursor width to 1 grapheme.
3 years ago
Nathan Vegdahl
85d5b399de
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
3 years ago
Nathan Vegdahl
6e15c9b874
Make vertical selection movement work properly.
3 years ago
Gokul Soumya
c68fe1f2a3
Add object selection (textobjects) ( #385 )
...
* 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
3 years ago
Nathan Vegdahl
28d2d68804
Make horizontal selection movement work properly.
3 years ago
Nathan Vegdahl
22dca3b111
Allow last line in file to lack a line break character.
3 years ago
Nathan Vegdahl
220bc85821
Fix all remaining warnings in helix-core except for two.
...
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.
3 years ago
Nathan Vegdahl
b571f28641
Remove #[allow(unused)] from helix-core, and fix unused imports.
...
Still a bunch more warnings to fix in core, but it's a start.
3 years ago
PabloMansanet
de8745aea7
Incorporate long word commands into keymap
3 years ago
PabloMansanet
73572b7780
Add long word unit tests
3 years ago
PabloMansanet
073517a92f
Add long word motion implementation
3 years ago
Nathan Vegdahl
07e28802f6
Add function to get the line ending of a str slice.
...
This is needed in some places.
3 years ago
Nathan Vegdahl
4efd6713c5
Work on moving code over to LineEnding instead of assuming '\n'.
...
Also some general cleanup and some minor fixes along the way.
3 years ago
Nathan Vegdahl
5d22e3c4e5
Misc fixes and clean up of line ending detect code.
3 years ago
Jan Hrastnik
8634e04a31
added the line_end helper function
3 years ago
Jan Hrastnik
701eb0dd68
changed some hardcoded newlines, removed a else if in line_ending.rs
3 years ago
PabloMansanet
86af55c379
Movement fixes, refactor and unit test suite ( #217 )
...
* 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
3 years ago
Ivan Tham
7cc13fefe9
Derive debug without feature
...
Note that this also removed those `finish_non_exhaustive()`.
3 years ago
notoria
1a3a924634
Implement Debug for data structure as a feature
3 years ago
Kirawi
b873fb9897
Fix Unicode ( #135 )
...
* init
* wip
* wip
* fix unicode break
* fix unicode break
* Update helix-core/src/transaction.rs
Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>
* clippy
* fix
* add changes
* added test
* wip
* wip
* wip
* wip
* fix
* fix view
* fix #88
Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>
3 years ago
Benoît CORTIER
8a29086c1a
Fix panic when moving over unicode punctuation
...
`is_ascii_punctuation` will only work for ASCII punctuations, and when
we have unicode punctuation (or other) we jump into the `unreachable`.
This patch fallback into categorizing everything in this branch as
`Unknown`.
Fixes https://github.com/helix-editor/helix/issues/123
https://github.com/helix-editor/helix/pull/135 : add better support for
unicode categories.
4 years ago
Ivan Tham
40744ce835
Add ctrl-w in insert mode
...
It seemed to panic when I pressed too many times, but that is from
lsp side.
4 years ago
Ivan Tham
6254720f53
Add unreachable context
...
Better error for #123
4 years ago
Kirawi
c17dcb8633
Fixing Multiple Panics ( #121 )
...
* init
* wip
* wip
4 years ago
Blaž Hrastnik
f4560cb68a
Better fix for w/e that also covers `ia<esc>we`/`ia<esc>wb`
4 years ago
Blaž Hrastnik
3ace581191
Fix panics when triggering w or e on the last char of the line
...
Closes #32
4 years ago
Blaž Hrastnik
c0264b9f7f
fix: Don't allow moving past last line, fixes #30 , #24
...
Off by 1 error
4 years ago
Blaž Hrastnik
2cc30cd07c
Categorize _ as a word char, not punctuation
4 years ago
Blaž Hrastnik
17e9386388
Allow moving to EOL byte, also fixes #15
4 years ago
Blaž Hrastnik
e8298a398c
Fix selection rendering, it would be off by 1 if reverse.
4 years ago
Blaž Hrastnik
9dfd6f6bbc
clippy lint
4 years ago
Blaž Hrastnik
59a0fc7b59
w, b, e: Match kakoune's behavior in selecting by default.
...
I initially preferred only moving the cursor, but selecting the whole
word is a lot nicer for things like wd (instead of vwd).
4 years ago
Blaž Hrastnik
c331721565
Finish hiding doc.state / State as an implementation detail.
4 years ago
Blaž Hrastnik
dbcc099f48
Move things out of state.rs.
4 years ago