Skip to content

Commit

Permalink
Reveal the current selection instead of document end
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricedb committed Oct 19, 2020
1 parent 7ac80e4 commit fecff6f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/instruction-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ const typeTextIntoActiveTextEditor = async (
editBuilder.insert(editor.selection.active, char!);
if (char === '\n') {
pos = new Position(pos.line + 1, pos.character);
// scroll to last line
const lastLine = editor.document.lineCount - 1;
const lastLineRange = editor.document.lineAt(lastLine).range;
editor.revealRange(lastLineRange);
// scroll to current line if needed
editor.revealRange(editor.selection, TextEditorRevealType.Default);
} else {
pos = new Position(pos.line, pos.character + 1);
}
Expand Down

0 comments on commit fecff6f

Please sign in to comment.