Commit Graph

7 Commits (c5298caa752dee136ab1a21dae27a702a00d8eea)

Author SHA1 Message Date
Nathan Vegdahl 953125d3f3
Fix around-word text-object selection. (#546)
* 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.
3 years ago
Nathan Vegdahl c9cbc344fc Fix buggy surround behavior from #376.
Fixes #543.
3 years ago
Nathan Vegdahl 5ee6ba5b38 Address some PR comments. 3 years ago
Nathan Vegdahl 0883b4fae0 Collect some common patterns into methods on `Range`. 3 years ago
Nathan Vegdahl b4c59b444c Update surround commands to work with gap indexing. 3 years ago
Gokul Soumya 351c1e7e55 Fix surround bug when cursor on same pair
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.
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