From efb4f48daeb4912f9d3222e31e50694d9e1049c4 Mon Sep 17 00:00:00 2001 From: Tim Hor Date: Mon, 3 Jan 2022 14:04:26 +1100 Subject: [PATCH] Fix go to end of line for selection spanning more than one line --- actions.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/actions.ts b/actions.ts index 5a5fe8b..731ba25 100644 --- a/actions.ts +++ b/actions.ts @@ -109,10 +109,13 @@ export const selectLine = (editor: Editor) => { }; export const goToLineBoundary = (editor: Editor, boundary: 'start' | 'end') => { - const { line } = editor.getCursor('from'); - editor.setSelection( - boundary === 'start' ? getLineStartPos(line) : getLineEndPos(line, editor), - ); + if (boundary === 'start') { + const { line } = editor.getCursor('from'); + editor.setSelection(getLineStartPos(line)); + } else { + const { line } = editor.getCursor('to'); + editor.setSelection(getLineEndPos(line, editor)); + } }; export const transformCase = (editor: Editor, caseType: CASE) => {