Skip to content

Commit

Permalink
Add customized killLine behaviour
Browse files Browse the repository at this point in the history
Useful for registering a visual-line-mode killLine for example.
  • Loading branch information
hrjakobsen committed Apr 6, 2023
1 parent 452cb4c commit cea6eae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,11 +720,15 @@ EmacsHandler.addCommands({
},
},
killLine: {
exec: function (handler: EmacsHandler) {
exec: function (handler: EmacsHandler, selectionCommand?: (view: EditorView) => any) {
handler.pushEmacsMark(null);
// don't delete the selection if it's before the cursor
handler.clearSelection();
commands.selectLineEnd(handler.view);
if (selectionCommand) {
selectionCommand(handler.view);
} else {
commands.selectLineEnd(handler.view);
}

var view = handler.view;
var state = view.state
Expand Down

0 comments on commit cea6eae

Please sign in to comment.