Conversation
Refactor: extract delete and deletion-related commands (such as change) from the insert function into a new function named `deleteSelections` Testing: ``` yarn test ```
71
left a comment
There was a problem hiding this comment.
Thanks! It does make sense having a dedicated delete function, rather than relying on insert.
| /** | ||
| * Delete contents of selection. | ||
| * | ||
| * @keys `d` (core: normal) |
There was a problem hiding this comment.
This will likely conflict with yank-delete defined below.
Ideally this command would be delete with @keys a-d (no yank), and d defined below.
| repetitions: number, | ||
| shift?: Argument<Shift>, | ||
| text?: Argument<string>, | ||
| text: Argument<string>, |
There was a problem hiding this comment.
Since some people may be using undefined text is their own keybindings, I think it'd be best to keep the previous behavior.
| } | ||
|
|
||
| /** | ||
| * Delete contents of selection. |
There was a problem hiding this comment.
I think it's somewhat unfortunate that this leads to both delete and deleteSelections being defined and doing the same thing. Am I correct to assume you used deleteSelections to avoid a conflict with the delete keyword? If so it may be worth naming it delete_ and teaching Dance to trim the trailing _.
| * | | | `s-r` (helix: select) | `[".edit.insert"], [".modes.set.normal"]` | | ||
| * | | | `a-d` (helix: select) | `[".edit.delete"], [".modes.set.normal"]` | | ||
| * | | | `d` (helix: select) | `[".edit.yank-delete"], [".modes.set.normal"]` | | ||
| * | | | `s-p` (helix: select) | `[".edit.paste.before"], [".modes.set.normal"]` | | ||
| * | | | `p` (helix: select) | `[".edit.paste.after"], [".modes.set.normal"]` | |
Refactor: extract delete and deletion-related commands (such as change) from the insert function into a new function named
deleteSelectionsContext:
For #376 I wanted to modify how deletion behaves slightly. It took me a while to understand how deletion actually works in dance (basically, you're pasting an empty string into your selection) and thought that having a separate command would make things more understandable.
Testing:
Note that all tests still pass without modifying them.