fix pagedown in vim mode

This commit is contained in:
nightwing 2015-01-24 18:53:41 +04:00
commit 0da0566bac

View file

@ -391,13 +391,19 @@ define(function(require, exports, module) {
sel.moveCursorBy(0, increment);
}
};
this.findPosV = function(start, amaount, unit, goalColumn) {
this.findPosV = function(start, amount, unit, goalColumn) {
if (unit == 'page') {
var renderer = this.ace.renderer;
var config = renderer.layerConfig;
amount = amount * Math.floor(config.height / config.lineHeight);
unit = 'line';
}
if (unit == 'line') {
var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch);
if (goalColumn != null)
screenPos.column = goalColumn;
screenPos.row += amaount;
// not what codemirror does but vim mode needs only it
screenPos.row += amount;
// not what codemirror does but vim mode needs only this
screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1);
var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column);
return toCmPos(pos);