Skip to content

Commit

Permalink
Activate optimization from VSCodeVim#4451 when `experimentalOptimizat…
Browse files Browse the repository at this point in the history
…ions` is enabled
  • Loading branch information
J-Fields committed Jan 4, 2020
1 parent 8bad868 commit 8eea11b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/history/historyTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ export class HistoryTracker {
*/
public addChange(cursorPosition = [new Position(0, 0)]): boolean {
if (configuration.experimentalOptimizations && !this._isDocumentTextNeeeded()) {
return;
return false;
}
const newText = this._getDocumentText();

Expand Down
9 changes: 5 additions & 4 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,16 +599,17 @@ export class ModeHandler implements vscode.Disposable {
// we'll grab the text of the incorrect active window and assume the
// whole document changed!

const mightChangeDocument = recordedState.hasRunOperator
? recordedState.operator.mightChangeDocument
: action.mightChangeDocument;

if (this.vimState.alteredHistory) {
this.vimState.alteredHistory = false;
vimState.historyTracker.ignoreChange();
} else {
} else if (!configuration.experimentalOptimizations || mightChangeDocument) {
const addedChange = vimState.historyTracker.addChange(
this.vimState.cursorsInitialState.map(c => c.stop)
);
const mightChangeDocument = recordedState.hasRunOperator
? recordedState.operator.mightChangeDocument
: action.mightChangeDocument;
if (addedChange && !mightChangeDocument) {
throw new Error(`Action '${action.toString()}' changed the document unexpectedly!`);
}
Expand Down

0 comments on commit 8eea11b

Please sign in to comment.