fix count handling for p and P
This commit is contained in:
parent
03ef921536
commit
901f598b20
2 changed files with 12 additions and 8 deletions
|
|
@ -247,7 +247,8 @@ var Document = function(text) {
|
|||
if (position.row >= length) {
|
||||
position.row = Math.max(0, length - 1);
|
||||
position.column = this.getLine(length-1).length;
|
||||
}
|
||||
} else if (position.row < 0)
|
||||
position.row = 0;
|
||||
return position;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ define(function(require, exports, module) {
|
|||
|
||||
"never use strict";
|
||||
|
||||
var lang = require("../../lib/lang");
|
||||
var util = require("./maps/util");
|
||||
var motions = require("./maps/motions");
|
||||
var operators = require("./maps/operators");
|
||||
|
|
@ -207,13 +208,14 @@ var actions = exports.actions = {
|
|||
editor.setOverwrite(false);
|
||||
if (defaultReg.isLine) {
|
||||
var pos = editor.getCursorPosition();
|
||||
var lines = defaultReg.text.split("\n");
|
||||
editor.session.getDocument().insertLines(pos.row + 1, lines);
|
||||
pos.column = editor.session.getLine(pos.row).length;
|
||||
var text = lang.stringRepeat("\n" + defaultReg.text, count);
|
||||
editor.session.insert(pos, text);
|
||||
editor.moveCursorTo(pos.row + 1, 0);
|
||||
}
|
||||
else {
|
||||
editor.navigateRight();
|
||||
editor.insert(defaultReg.text);
|
||||
editor.insert(lang.stringRepeat(defaultReg.text, count));
|
||||
editor.navigateLeft();
|
||||
}
|
||||
editor.setOverwrite(true);
|
||||
|
|
@ -227,12 +229,13 @@ var actions = exports.actions = {
|
|||
|
||||
if (defaultReg.isLine) {
|
||||
var pos = editor.getCursorPosition();
|
||||
var lines = defaultReg.text.split("\n");
|
||||
editor.session.getDocument().insertLines(pos.row, lines);
|
||||
editor.moveCursorTo(pos.row, 0);
|
||||
pos.column = 0;
|
||||
var text = lang.stringRepeat(defaultReg.text + "\n", count);
|
||||
editor.session.insert(pos, text);
|
||||
editor.moveCursorToPosition(pos);
|
||||
}
|
||||
else {
|
||||
editor.insert(defaultReg.text);
|
||||
editor.insert(lang.stringRepeat(defaultReg.text, count));
|
||||
}
|
||||
editor.setOverwrite(true);
|
||||
editor.selection.clearSelection();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue