mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-09-11 20:27:17 +03:00
Merge pull request #3472 from rickythefox/master
Set < and > marks when yanking in visual mode.
This commit is contained in:
commit
fa0285dc8d
@ -261,25 +261,30 @@ export class YankOperator extends BaseOperator {
|
||||
if (end.isEarlierThan(start)) {
|
||||
[start, end] = [end, start];
|
||||
}
|
||||
end = new Position(end.line, end.character + 1);
|
||||
let extendedEnd = new Position(end.line, end.character + 1);
|
||||
|
||||
if (vimState.currentRegisterMode === RegisterMode.LineWise) {
|
||||
start = start.getLineBegin();
|
||||
end = end.getLineEnd();
|
||||
extendedEnd = extendedEnd.getLineEnd();
|
||||
}
|
||||
|
||||
let text = TextEditor.getText(new vscode.Range(start, end));
|
||||
let text = TextEditor.getText(new vscode.Range(start, extendedEnd));
|
||||
|
||||
// If we selected the newline character, add it as well.
|
||||
if (
|
||||
vimState.currentMode === ModeName.Visual &&
|
||||
end.character === TextEditor.getLineAt(end).text.length + 1
|
||||
extendedEnd.character === TextEditor.getLineAt(extendedEnd).text.length + 1
|
||||
) {
|
||||
text = text + '\n';
|
||||
}
|
||||
|
||||
Register.put(text, vimState, this.multicursorIndex);
|
||||
|
||||
if (vimState.currentMode === ModeName.Visual || vimState.currentMode === ModeName.VisualLine) {
|
||||
vimState.historyTracker.addMark(start, '<');
|
||||
vimState.historyTracker.addMark(end, '>');
|
||||
}
|
||||
|
||||
await vimState.setCurrentMode(ModeName.Normal);
|
||||
vimState.cursorStartPosition = start;
|
||||
|
||||
@ -660,6 +665,9 @@ export class YankVisualBlockMode extends BaseOperator {
|
||||
|
||||
Register.put(toCopy, vimState, this.multicursorIndex);
|
||||
|
||||
vimState.historyTracker.addMark(start, '<');
|
||||
vimState.historyTracker.addMark(end, '>');
|
||||
|
||||
const numLinesYanked = toCopy.split('\n').length;
|
||||
ReportLinesYanked(numLinesYanked, vimState);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user