Skip to content

Commit 77137e3

Browse files
authored
Vi mode text objects for word, WORD, brackets and quotes (#939)
* Addd initial change inner and around word text objects and handle whitespace Note a buffer full of whitespace is not properly considered and still causing incorrect behaviour. TODO fix this. * Renaming functions and fix default value of current_whitespace_range_start * Rename cut/yank inside enums and methods to cut/yank inside pair and add general yank/cut range methods * Use TextObject enum instead of passing through the character * WIP: Add quote and bracket text objects and add jumping if not inside objects * Add my own methods for finding matching pair and jumping * Fix bugs in new function to get matching pair range and it's finish features - Now handles jumps to next open/close or equal symbol pairs if not in a pair already - Searching only on current line for equal symbol pairs e.g. quotes - Correctly handles graphemes * Simplify heirarchy of pair range finding functions - Refactor the structure of the methods to get ranges, don't need to pass in depth unecessarily, high level functions don't require cursor passed in. - Now two seperate functions for ranges, one "next" and one "current" range that gets you either the range inside next text object or inside current one depending on position of cursor. - Finilise logic to correctly handle graphemes (not byte sized chars) TODO Update unit tests * Refactoring range functions and tidy up/extend unit test cases and coverage * More refactoring - Improve some text object ranges to use iterators rather than complex logic - Clean up documentation, add consts etc - Look through and refactor some editor functions * Move text object range methods into line_buffer from editor * Combine line_buffer quote and pair text object functions into generic and rewrite a lot of doc strings * Testing for quote and bracket text object functions in editor.rs * Whitespace * Rework unit tests for new function structure * Remove angle brackets from b text object * Rename yank text object functions to copy * Add bracket test cases to range_inside_next_pair_in_group unit tests * Add more detailed unicode safety tests * Fix display enum string for renamed enums * Unicode and overflow/underflow safety when expanding text object ranges * Pass through matching pair group const for quote and bracket text object functions * Rename yank_range -> copy_range for consistency with other methods * Remove unecessary guard clause from expand_range_to_include_pair * Correct display string for CutInsidePair
1 parent d027940 commit 77137e3

File tree

5 files changed

+1393
-318
lines changed

5 files changed

+1393
-318
lines changed

0 commit comments

Comments
 (0)