Commit Graph

16 Commits (master)

Author SHA1 Message Date
Krishan 89a9f2be78
specify direction for select_prev_sibling and select_next_sibling (#10542)
* specify direction for select_prev_sibling and select_next_sibling

* fix failing integration-test
2 months ago
Skyler Hawthorne c99c333337 Use new in-crate TreeCursor 3 months ago
Skyler Hawthorne fa67c5c474 feat(command): select_all_children 3 months ago
Skyler Hawthorne 87c4161732 feat(command): select_all_siblings 3 months ago
Michael Davis 68b21578ac Reimplement tree motions in terms of syntax::TreeCursor
This uses the new TreeCursor type from the parent commit to reimplement
the tree-sitter motions (`A-p/o/i/n`). Other tree-sitter related
features like textobjects are not touched with this change and will
need a different, unrelated approach to solve.
3 months ago
Triton171 e1b1a5ebc0
Fix edge-case in tree-sitter expand_selection selection command (#2877)
Co-authored-by: Triton171 <triton0171@gmail.com>
2 years ago
Michael Davis 392dfa0841
add select_next_sibling and select_prev_sibling commands (#1495)
* add select_next_sibling and select_prev_sibling commands

* refactor objects to use higher order functions

* address clippy feedback

* move selection cloning into commands

* add default keybindings under left/right brackets

* use [+t,]+t for selecting sibling syntax nodes

* setup Alt-{j,k,h,l} default keymaps for syntax selection commands

* reduce boilerplate of select_next/prev_sibling in commands

* import tree-sitter Node type in commands
2 years ago
Michael Davis 939261fc07
expand_selection to current node with no children (#1454) 2 years ago
Matouš Dzivjak 2e02a1d6bc
feat(commands): shrink_selection (#1340)
* 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
3 years ago
cossonleo befecc8a9a select smaller range on some case 3 years ago
Nathan Vegdahl 2224a1527e Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 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
Nathan Vegdahl 7c7be6d583 Make `Selection`'s normalize and transform methods self-consuming only. 3 years ago
Nathan Vegdahl 0ae522f3df Clean up `Selection` to not use so many allocations. 3 years ago
Blaž Hrastnik ad3325db8e minor: Remove a few unwraps. 3 years ago
Blaž Hrastnik 6cfb1acb9d commands: Implement expand_selection. 3 years ago