fix pagedown in vim mode
This commit is contained in:
parent
8df1eb70c5
commit
0da0566bac
1 changed files with 9 additions and 3 deletions
|
|
@ -391,13 +391,19 @@ define(function(require, exports, module) {
|
||||||
sel.moveCursorBy(0, increment);
|
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') {
|
if (unit == 'line') {
|
||||||
var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch);
|
var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch);
|
||||||
if (goalColumn != null)
|
if (goalColumn != null)
|
||||||
screenPos.column = goalColumn;
|
screenPos.column = goalColumn;
|
||||||
screenPos.row += amaount;
|
screenPos.row += amount;
|
||||||
// not what codemirror does but vim mode needs only it
|
// not what codemirror does but vim mode needs only this
|
||||||
screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1);
|
screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1);
|
||||||
var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column);
|
var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column);
|
||||||
return toCmPos(pos);
|
return toCmPos(pos);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue