aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/movement.rs
Commit message (Collapse)AuthorAge
* Respect injections in movement::move_parent_node_endMichael Davis2024-01-28
|
* add node boundary movementSkyler Hawthorne2023-08-01
|
* Fix next/prev tree-sitter inconsistency (#7332)A-Walrus2023-06-13
| | | | | | | | | * Fix next/prev tree-sitter inconsistency Before there where different results going to next or previous due to sorting not dealing with multiple captures that start/end at the same pos. I chose to prefer longer matches. * Revert unnecessary change
* add move_prev_long_word_end and extend_prev_long_word_end (#6905)vwkd2023-06-07
|
* return early if soft wrap is invalid (#6856)ymgyt2023-04-23
|
* fix test::plainSkyler Hawthorne2023-03-20
| | | | test::plain uses char indices when it should use byte indices
* Allow explicit newlines in test DSLSkyler Hawthorne2023-03-20
| | | | | | | | | | | | | The current test DSL currently has no way to express being at the end of a line, save for putting an explicit LF or CRLF inside the `#[|]#`. The problem with this approach is that it can add unintended extra new lines if used in conjunction with raw strings, which insert newlines for you. This is a simple attempt to mitigate this problem. If there is an explicit newline character at the end of the selection, and then it is immediately followed by the same newline character at the right end of the selection, this following newline is removed. This way, one can express a cursor at the end of a line explicitly.
* Short-circuit the word and treesitter object movement commands (#5851)Mike Trinkala2023-02-07
| | | | | | | | | The loop always iterates the number of times the user specified even if the beginning/end of the document is reached. For an extreme demonstration try the following commands, Helix will hang for several seconds. 100000000w 100000000]c
* rework positioning/rendering and enable softwrap/virtual text (#5420)Pascal Kuthe2023-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rework positioning/rendering, enables softwrap/virtual text This commit is a large rework of the core text positioning and rendering code in helix to remove the assumption that on-screen columns/lines correspond to text columns/lines. A generic `DocFormatter` is introduced that positions graphemes on and is used both for rendering and for movements/scrolling. Both virtual text support (inline, grapheme overlay and multi-line) and a capable softwrap implementation is included. fix picker highlight cleanup doc formatter, use word bondaries for wrapping make visual vertical movement a seperate commnad estimate line gutter width to improve performance cache cursor position cleanup and optimize doc formatter cleanup documentation fix typos Co-authored-by: Daniel Hines <d4hines@gmail.com> update documentation fix panic in last_visual_line funciton improve soft-wrap documentation add extend_visual_line_up/down commands fix non-visual vertical movement streamline virtual text highlighting, add softwrap indicator fix cursor position if softwrap is disabled improve documentation of text_annotations module avoid crashes if view anchor is out of bounds fix: consider horizontal offset when traslation char_idx -> vpos improve default configuration fix: mixed up horizontal and vertical offset reset view position after config reload apply suggestions from review disabled softwrap for very small screens to avoid endless spin fix wrap_indicator setting fix bar cursor disappearring on the EOF character add keybinding for linewise vertical movement fix: inconsistent gutter highlights improve virtual text API make scope idx lookup more ergonomic allow overlapping overlays correctly track char_pos for virtual text adjust configuration deprecate old position fucntions fix infinite loop in highlight lookup fix gutter style fix formatting document max-line-width interaction with softwrap change wrap-indicator example to use empty string fix: rare panic when view is in invalid state (bis) * Apply suggestions from code review Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * improve documentation for positoning functions * simplify tests * fix documentation of Grapheme::width * Apply suggestions from code review Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * add explicit drop invocation * Add explicit MoveFn type alias * add docuntation to Editor::cursor_cache * fix a few typos * explain use of allow(deprecated) * make gj and gk extend in select mode * remove unneded debug and TODO * mark tab_width_at #[inline] * add fast-path to move_vertically_visual in case softwrap is disabled * rename first_line to first_visual_line * simplify duplicate if/else --------- Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Use requested direction for new textobject selection rangeMichael Davis2022-10-03
| | | | | | | | | | | | | | | | | | 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`.
* Fix typos (#3858)taupiqueur2022-09-17
|
* respect count in treesitter movement (#3058)Bob2022-07-14
|
* feat: make `move_vertically` aware of tabs and wide characters (#2620)Matthew Toohey2022-06-21
| | | | | | | | | | | | | * feat: make `move_vertically` aware of tabs and wide characters * refactor: replace unnecessary checked_sub with comparison * refactor: leave pos_at_coords unchanged and introduce separate pos_at_visual_coords * style: include comment to explain `pos_at_visual_coords` breaking condition * refactor: use `pos_at_visual_coords` in `text_pos_at_screen_coords` * feat: make `copy_selection_on_line` aware of wide characters
* Remove usage of format ident feature from tests (#2028)Michael Davis2022-04-08
|
* Fix next paragraph logic over muliple blank lines (#1951)Ivan Tham2022-04-05
| | | Fix #1928
* Rename _para to _paragraphIvan Tham2022-04-02
|
* Change test mark from ^@ to #[|]#Ivan Tham2022-04-02
|
* Add paragraph textobjectIvan Tham2022-04-02
| | | | | Change parameter/argument key from p to a since paragraph only have p but parameter are also called arguments sometimes and a is not used.
* Add next paragraphIvan Tham2022-04-02
|
* Add (prev) paragraph motionIvan Tham2022-04-02
| | | | | | Also improved testing facility. Fix #1580
* Add object.movement for tree-sitter navigationGokul Soumya2022-02-15
|
* Add tree-sitter based function, class navigationGokul Soumya2022-02-15
|
* Apply recent nightly suggestions (#1286)Kirawi2021-12-18
| | | array iterators are now implicit
* Add trim_selections command (#1092)ath32021-11-14
|
* Ensure coords in screen depends on char width (#885)Ivan Tham2021-11-03
| | | | | The issue affected files with lots of tabs at the start as well. Fix #840
* Fixes for new clippy lints in Rust 1.54.Nathan Vegdahl2021-07-29
|
* Minor cleanup of the vertical movement code.Nathan Vegdahl2021-07-27
|
* Use `match` for branching on the `Direction` enum in more places.Nathan Vegdahl2021-07-27
|
* Collect some common patterns into methods on `Range`.Nathan Vegdahl2021-07-26
|
* Switch to a cleaner range-head moving abstraction.Nathan Vegdahl2021-07-24
| | | | Also fix a bunch of bugs related to it.
* Revert display-width-based vertical cursor movement.Nathan Vegdahl2021-07-22
| | | | Still needs to be done, but should be part of a separate PR.
* Fixes for misc bugs with view movement.Nathan Vegdahl2021-07-21
|
* Handle edge case in `range_to_target()` correctly.Nathan Vegdahl2021-07-19
|
* Update word selection/navigation to work with gap indexing.Nathan Vegdahl2021-07-19
| | | | | | Also tweaked some of the existing behavior that seemed inconsistent and/or buggy. It's mostly identical, just a few corner cases are different.
* Update surround commands to work with gap indexing.Nathan Vegdahl2021-07-08
|
* Implement `Range::put()` which manages range movements and extensions.Nathan Vegdahl2021-07-08
| | | | | In particular, this wraps the annoying logic involved in keeping the cursor width to 1 grapheme.
* Merge branch 'master' into great_line_ending_and_cursor_range_cleanupNathan Vegdahl2021-07-06
|\
| * Add object selection (textobjects) (#385)Gokul Soumya2021-07-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* | Make vertical selection movement work properly.Nathan Vegdahl2021-07-06
| |
* | Make horizontal selection movement work properly.Nathan Vegdahl2021-07-02
| |
* | Allow last line in file to lack a line break character.Nathan Vegdahl2021-07-02
|/
* Fix all remaining warnings in helix-core except for two.Nathan Vegdahl2021-07-02
| | | | | 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.
* Remove #[allow(unused)] from helix-core, and fix unused imports.Nathan Vegdahl2021-07-02
| | | | Still a bunch more warnings to fix in core, but it's a start.
* Incorporate long word commands into keymapPabloMansanet2021-06-29
|
* Add long word unit testsPabloMansanet2021-06-29
|
* Add long word motion implementationPabloMansanet2021-06-29
|
* Add function to get the line ending of a str slice.Nathan Vegdahl2021-06-21
| | | | This is needed in some places.
* Work on moving code over to LineEnding instead of assuming '\n'.Nathan Vegdahl2021-06-20
| | | | Also some general cleanup and some minor fixes along the way.
* Misc fixes and clean up of line ending detect code.Nathan Vegdahl2021-06-20
|
* added the line_end helper functionJan Hrastnik2021-06-20
|