Skip to content

Commit

Permalink
Fixes #1743
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee committed May 29, 2017
1 parent 5c1500a commit 3a97b88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
19 changes: 10 additions & 9 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1121,9 +1121,12 @@ export class PutCommand extends BaseCommand {

if (register.text instanceof RecordedState) {
/**
* Paste content from recordedState. This one is actually complex as Vim has internal key code for key strokes.
* For example, Backspace is stored as `<80>kb`. So if you replay a macro, which is stored in a register as `a1<80>kb2`, you
* shall just get `2` inserted as `a` represents entering Insert Mode, `<80>bk` represents Backspace. However here, we shall
* Paste content from recordedState. This one is actually complex as
* Vim has internal key code for key strokes.For example, Backspace
* is stored as `<80>kb`. So if you replay a macro, which is stored
* in a register as `a1<80>kb2`, youshall just get `2` inserted as
* `a` represents entering Insert Mode, `<80>bk` represents
* Backspace. However here, we shall
* insert the plain text content of the register, which is `a1<80>kb2`.
*/
vimState.recordedState.transformations.push({
Expand Down Expand Up @@ -1362,13 +1365,11 @@ export class PutCommandVisual extends BaseCommand {
[start, end] = [end, start];
}

// If the to be inserted text is linewise
// we have a seperate logik
// delete the selection first
// than insert
// If the to be inserted text is linewise we have a seperate logik delete the
// selection first than insert
let register = await Register.get(vimState);
if (register.registerMode === RegisterMode.LineWise) {
let result = await new operator.DeleteOperator(this.multicursorIndex).run(vimState, start, end.getLeft(), false);
let result = await new operator.DeleteOperator(this.multicursorIndex).run(vimState, start, end, false);
// to ensure, that the put command nows this is
// an linewise register insertion in visual mode
let oldMode = result.currentMode;
Expand All @@ -1383,12 +1384,12 @@ export class PutCommandVisual extends BaseCommand {
// linewise but not necessarily delete linewise.
let result = await new PutCommand(this.multicursorIndex).exec(start, vimState, true);
result.currentRegisterMode = isLineWise ? RegisterMode.LineWise : RegisterMode.CharacterWise;
result.recordedState.registerName = Configuration.useSystemClipboard ? '*' : '"';
result = await new operator.YankOperator(this.multicursorIndex).run(result, start, end);
result.currentRegisterMode = RegisterMode.CharacterWise;
result = await new operator.DeleteOperator(this.multicursorIndex).run(result, start, end.getLeftIfEOL(), false);
result.currentRegisterMode = RegisterMode.FigureItOutFromCurrentMode;
return result;

}

// TODO - execWithCount
Expand Down
3 changes: 1 addition & 2 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ export class VimState {
*/
export class RecordedState {
constructor() {
const useClipboard = Configuration.useSystemClipboard;
this.registerName = useClipboard ? '*' : '"';
this.registerName = Configuration.useSystemClipboard ? '*' : '"';
}

/**
Expand Down

0 comments on commit 3a97b88

Please sign in to comment.