Fix to keep selections on save and restore info

This commit is contained in:
Wu Cheng-Han 2017-02-18 20:10:34 +08:00
parent 2aee0f267c
commit f7149f5a83

View file

@ -408,7 +408,8 @@ window.lastInfo = {
cursor: { cursor: {
line: null, line: null,
ch: null ch: null
} },
selections: null
}, },
view: { view: {
scroll: { scroll: {
@ -3394,6 +3395,7 @@ function saveInfo() {
break; break;
} }
lastInfo.edit.cursor = editor.getCursor(); lastInfo.edit.cursor = editor.getCursor();
lastInfo.edit.selections = editor.listSelections();
lastInfo.needRestore = true; lastInfo.needRestore = true;
} }
@ -3403,6 +3405,7 @@ function restoreInfo() {
var line = lastInfo.edit.cursor.line; var line = lastInfo.edit.cursor.line;
var ch = lastInfo.edit.cursor.ch; var ch = lastInfo.edit.cursor.ch;
editor.setCursor(line, ch); editor.setCursor(line, ch);
editor.setSelections(lastInfo.edit.selections);
switch (currentMode) { switch (currentMode) {
case modeType.edit: case modeType.edit:
if (scrollbarStyle == 'native') { if (scrollbarStyle == 'native') {