aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/textobject.rs
Commit message (Collapse)AuthorAge
* Adjust `m` textobject description and minor code clarification (#3343)Daniel S Poulin2022-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update description of `m` textobject to its actual functionality Sometime recently the functionality of `m` was changed to match the nearest pair to the cursor, rather than the former functionality of matching the pair only if the cursor was on one of the brace characters directly. * Rename surround methods to reflect that they work on pairs The current naming suggests that they may work generally on any textobject, whereas their implementation really focuses on pairs. * Change description of m textobject to match actual functionality The current implementation of `m` no longer merely looks at the pair character the cursor is on, but actually will search for the pair (defined in helix-core/src/surround.rs) that encloses the cursor, and not the entire selection. * Accept suggested wording change Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Prefix pair surround for consistency Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Add `m` textobject to select closest surround pairGokul Soumya2022-04-29
|
* Make textobject select last paragraph (#1992)Ivan Tham2022-04-13
| | | | | | | | | | | | | | | | * Make textobject select last paragraph Last paragraph shoud be selected if the cursor was placed on the whitespace paragraph part and `map` is done, otherwise it would do nothing useful, but now we select backwards for the last paragraph which behaves similarly to kakoune, making `map` useful for the last paragraph with whitespace. Example usecase is to copy and paste last ledger cli paragraph quickly by `mapyp` to duplicate last entry. * Fix typo in core textobject Co-authored-by: Michael Davis <mcarsondavis@gmail.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Remove usage of format ident feature from tests (#2028)Michael Davis2022-04-08
|
* 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 object.movement for tree-sitter navigationGokul Soumya2022-02-15
|
* Fix surround cursor position calculation (#1183)Gokul Soumya2021-11-29
| | | | | | | | | | | | | | | 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 WORD textobject (#991)Omnikar2021-11-08
| | | | | * Add WORD textobject * Document WORD textobject
* Add treesitter textobjects (#728)Gokul Soumya2021-10-23
| | | | | | | | | | | | | | | | | | | | | | | | | * Add treesitter textobject queries Only for Go, Python and Rust for now. * Add tree-sitter textobjects Only has functions and class objects as of now. * Fix tests * Add docs for tree-sitter textobjects * Add guide for creating new textobject queries * Add parameter textobject Only parameter.inside is implemented now, parameter.around will probably require custom predicates akin to nvim' `make-range` since we want to select a trailing comma too (a comma will be an anonymous node and matching against them doesn't work similar to named nodes) * Simplify TextObject cell init
* Fix around-word text-object selection. (#546)Nathan Vegdahl2021-08-06
| | | | | | | | | | | | | * Fix around-word text-object selection. * Text object around-word: select to the left if no whitespace on the right. Also only select around when there's whitespace at all. * Make select-word-around select all white space on a side. * Update commented-out test case. * Fix unused import warning from rebase.
* Fix buggy surround behavior from #376.Nathan Vegdahl2021-08-04
| | | | Fixes #543.
* Address some PR comments.Nathan Vegdahl2021-07-26
|
* Collect some common patterns into methods on `Range`.Nathan Vegdahl2021-07-26
|
* Update surround commands to work with gap indexing.Nathan Vegdahl2021-07-08
|
* Fix surround bug when cursor on same pairGokul Soumya2021-07-03
| | | | | | For example when the cursor is _on_ the `'` in `'word'`, the cursor wouldn't move because the search for a matching pair started _from_ the position of the cursor and simply found itself.
* 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