fix: pasting code, which starts with a doc comment
indents the whole code block
This commit is contained in:
parent
08e721b22f
commit
3ef6e5f003
1 changed files with 12 additions and 6 deletions
|
|
@ -383,14 +383,20 @@ var Editor = function(renderer, doc) {
|
|||
this.clearSelection();
|
||||
|
||||
var _self = this;
|
||||
var row = cursor.row;
|
||||
this.bgTokenizer.getState(cursor.row-1, function(lineState) {
|
||||
var shouldOutdent = _self.mode.checkOutdent(lineState, _self.doc.getLine(cursor.row), text);
|
||||
|
||||
var shouldOutdent = _self.mode.checkOutdent(lineState, _self.doc.getLine(row), text);
|
||||
var line = _self.doc.getLine(row);
|
||||
var end = _self.doc.insert(cursor, text);
|
||||
|
||||
var row = cursor.row;
|
||||
if (line != _self.doc.getLine(row)) {
|
||||
_self.moveCursorToPosition(end);
|
||||
_self.renderer.scrollCursorIntoView();
|
||||
return;
|
||||
}
|
||||
|
||||
var line = _self.doc.getLine(row);
|
||||
_self.bgTokenizer.getState(row, function(lineState ) {
|
||||
_self.bgTokenizer.getState(row, function(lineState) {
|
||||
// multi line insert
|
||||
if (row !== end.row) {
|
||||
var indent = _self.mode.getNextLineIndent(lineState, line, _self.doc.getTabString());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue