Skip to content

Commit

Permalink
Fix go to end of line for selection spanning more than one line
Browse files Browse the repository at this point in the history
  • Loading branch information
timhor committed Jan 3, 2022
1 parent e942195 commit efb4f48
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit efb4f48

Please sign in to comment.