mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-09-19 16:18:45 +03:00
* fixes #888 * Change the way we handle replace on last character
This commit is contained in:
parent
c845e04b73
commit
c567194c54
@ -3532,11 +3532,23 @@ class ActionReplaceCharacter extends BaseCommand {
|
||||
return vimState;
|
||||
}
|
||||
|
||||
let endPos = new Position(position.line, position.character + timesToRepeat);
|
||||
|
||||
// Return if tried to repeat longer than linelength
|
||||
if (endPos.character > TextEditor.getLineAt(endPos).text.length) {
|
||||
return vimState;
|
||||
}
|
||||
|
||||
// If last char (not EOL char), add 1 so that replace selection is complete
|
||||
if (endPos.character > TextEditor.getLineAt(endPos).text.length) {
|
||||
endPos = new Position(endPos.line, endPos.character + 1);
|
||||
}
|
||||
|
||||
vimState.recordedState.transformations.push({
|
||||
type : "replaceText",
|
||||
text : toReplace.repeat(timesToRepeat),
|
||||
start : position,
|
||||
end : position.getRightByCount(timesToRepeat),
|
||||
end : endPos,
|
||||
diff : new PositionDiff(0, timesToRepeat - 1),
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user