Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ define(function (require, exports, module) {
var nonWS = lineStr.search(/\S/);

if (nonWS === -1 || nonWS >= cursor.ch) {
if (nonWS === -1) {
// if the line is all whitespace, move the cursor to the end of the line
// before indenting so that embedded whitespace such as indents are not
// orphaned to the right of the electric char being inserted
this.setCursorPos(cursor.line, this.document.getLine(cursor.line).length);
}
// Need to do the auto-indent on a timeout to ensure
// the keypress is handled before auto-indenting.
// This is the same timeout value used by the
Expand Down