center cursor after vim jumplist motions
Conflicts: lib/ace/editor.js
This commit is contained in:
parent
b0ce5630c9
commit
2713d0a8db
2 changed files with 11 additions and 3 deletions
|
|
@ -162,8 +162,12 @@ var Editor = function(renderer, session) {
|
||||||
var command = this.curOp.command;
|
var command = this.curOp.command;
|
||||||
if (command.name && this.$blockScrolling > 0)
|
if (command.name && this.$blockScrolling > 0)
|
||||||
this.$blockScrolling--;
|
this.$blockScrolling--;
|
||||||
if (command && command.scrollIntoView) {
|
var scrollIntoView = command && command.scrollIntoView;
|
||||||
switch (command.scrollIntoView) {
|
if (scrollIntoView) {
|
||||||
|
switch (scrollIntoView) {
|
||||||
|
case "center-animate":
|
||||||
|
scrollIntoView = "animate";
|
||||||
|
/* fall through */
|
||||||
case "center":
|
case "center":
|
||||||
this.renderer.scrollCursorIntoView(null, 0.5);
|
this.renderer.scrollCursorIntoView(null, 0.5);
|
||||||
break;
|
break;
|
||||||
|
|
@ -181,7 +185,7 @@ var Editor = function(renderer, session) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (command.scrollIntoView == "animate")
|
if (scrollIntoView == "animate")
|
||||||
this.renderer.animateScrolling(this.curOp.scrollTop);
|
this.renderer.animateScrolling(this.curOp.scrollTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,7 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
if (!this.ace.inVirtualSelectionMode)
|
if (!this.ace.inVirtualSelectionMode)
|
||||||
this.ace.exitMultiSelectMode();
|
this.ace.exitMultiSelectMode();
|
||||||
|
this.ace.session.unfold({row: line, column: ch});
|
||||||
this.ace.selection.moveTo(line, ch);
|
this.ace.selection.moveTo(line, ch);
|
||||||
};
|
};
|
||||||
this.getCursor = function(p) {
|
this.getCursor = function(p) {
|
||||||
|
|
@ -2204,6 +2205,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (motionArgs.toJumplist) {
|
if (motionArgs.toJumplist) {
|
||||||
|
if (!operator)
|
||||||
|
cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace patch
|
||||||
var jumpList = vimGlobalState.jumpList;
|
var jumpList = vimGlobalState.jumpList;
|
||||||
// if the current motion is # or *, use cachedCursor
|
// if the current motion is # or *, use cachedCursor
|
||||||
var cachedCursor = jumpList.cachedCursor;
|
var cachedCursor = jumpList.cachedCursor;
|
||||||
|
|
@ -2890,6 +2893,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
||||||
var markPos = mark ? mark.find() : undefined;
|
var markPos = mark ? mark.find() : undefined;
|
||||||
markPos = markPos ? markPos : cm.getCursor();
|
markPos = markPos ? markPos : cm.getCursor();
|
||||||
cm.setCursor(markPos);
|
cm.setCursor(markPos);
|
||||||
|
cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace patch
|
||||||
},
|
},
|
||||||
scroll: function(cm, actionArgs, vim) {
|
scroll: function(cm, actionArgs, vim) {
|
||||||
if (vim.visualMode) {
|
if (vim.visualMode) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue