Commit Graph

16 Commits (24e3ccc31b0ace22ce4298cae61b24ddf71e2419)

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
2024-04-23 08:41:03 -05:00
Skyler Hawthorne c99c333337 Use new in-crate TreeCursor 2024-04-09 10:33:15 -04:00
Skyler Hawthorne fa67c5c474 feat(command): select_all_children 2024-04-09 10:33:15 -04:00
Skyler Hawthorne 87c4161732 feat(command): select_all_siblings 2024-04-09 10:33:15 -04:00
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.
2024-03-23 15:32:34 +09:00
Triton171 e1b1a5ebc0
Fix edge-case in tree-sitter expand_selection selection command (#2877)
Co-authored-by: Triton171 <triton0171@gmail.com>
2022-06-25 13:12:30 -05:00
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
2022-01-21 00:52:33 +09:00
Michael Davis 939261fc07
expand_selection to current node with no children (#1454) 2022-01-09 00:31:05 +09:00
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
2022-01-06 11:12:02 +09:00
cossonleo befecc8a9a select smaller range on some case 2021-10-29 10:04:12 +09:00
Nathan Vegdahl 2224a1527e Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-01 19:37:28 -07:00
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.
2021-07-01 19:06:52 -07:00
Nathan Vegdahl 7c7be6d583 Make `Selection`'s normalize and transform methods self-consuming only. 2021-07-01 14:22:28 -07:00
Nathan Vegdahl 0ae522f3df Clean up `Selection` to not use so many allocations. 2021-07-01 14:22:28 -07:00
Blaž Hrastnik ad3325db8e minor: Remove a few unwraps. 2021-03-26 11:03:14 +09:00
Blaž Hrastnik 6cfb1acb9d commands: Implement expand_selection. 2021-02-22 17:02:32 +09:00