Skip to content

Commit fc8551a

Browse files
committed
restore cursor pos when formating
1 parent 5487096 commit fc8551a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/runtime/formatter.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ function formatEditorTextInRange (editor, range, text) {
4949
})
5050
} else {
5151
if (marker.isValid()) {
52+
const pos = editor.getCursorBufferPosition()
5253
editor.setTextInBufferRange(marker.getBufferRange(), formattedtext)
54+
editor.scrollToBufferPosition(pos)
55+
editor.setCursorBufferPosition(pos)
5356
} else {
5457
atom.notifications.addError('Julia-Client: Format-Code', {
5558
description: 'Cancelled the formatting task because the selected code has been manually modified.',

0 commit comments

Comments
 (0)