center cursor after vim jumplist motions

Conflicts:
	lib/ace/editor.js
This commit is contained in:
nightwing 2015-01-26 19:44:27 +04:00
commit 2713d0a8db
2 changed files with 11 additions and 3 deletions

View file

@ -162,8 +162,12 @@ var Editor = function(renderer, session) {
var command = this.curOp.command;
if (command.name && this.$blockScrolling > 0)
this.$blockScrolling--;
if (command && command.scrollIntoView) {
switch (command.scrollIntoView) {
var scrollIntoView = command && command.scrollIntoView;
if (scrollIntoView) {
switch (scrollIntoView) {
case "center-animate":
scrollIntoView = "animate";
/* fall through */
case "center":
this.renderer.scrollCursorIntoView(null, 0.5);
break;
@ -181,7 +185,7 @@ var Editor = function(renderer, session) {
default:
break;
}
if (command.scrollIntoView == "animate")
if (scrollIntoView == "animate")
this.renderer.animateScrolling(this.curOp.scrollTop);
}

View file

@ -264,6 +264,7 @@ define(function(require, exports, module) {
}
if (!this.ace.inVirtualSelectionMode)
this.ace.exitMultiSelectMode();
this.ace.session.unfold({row: line, column: ch});
this.ace.selection.moveTo(line, ch);
};
this.getCursor = function(p) {
@ -2204,6 +2205,8 @@ dom.importCssString(".normal-mode .ace_cursor{\
return;
}
if (motionArgs.toJumplist) {
if (!operator)
cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace patch
var jumpList = vimGlobalState.jumpList;
// if the current motion is # or *, use cachedCursor
var cachedCursor = jumpList.cachedCursor;
@ -2890,6 +2893,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
var markPos = mark ? mark.find() : undefined;
markPos = markPos ? markPos : cm.getCursor();
cm.setCursor(markPos);
cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace patch
},
scroll: function(cm, actionArgs, vim) {
if (vim.visualMode) {