-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for failed motions #466
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -707,6 +707,10 @@ export class ModeHandler implements vscode.Disposable { | |
if (result instanceof Position) { | ||
vimState.cursorPosition = result; | ||
} else if (isIMovement(result)) { | ||
if (result.failed) { | ||
vimState.recordedState = new RecordedState(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is the line that is causing #474, since the stacktrace we're getting is coming from
But more guessing than actually understanding what "recorded state" is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, sorry, RecorededState is an awful name! It used to be called ActionState, which was a little better, but still bad. |
||
} | ||
|
||
vimState.cursorPosition = result.stop; | ||
vimState.cursorStartPosition = result.start; | ||
|
||
|
@@ -740,8 +744,8 @@ export class ModeHandler implements vscode.Disposable { | |
} | ||
|
||
private async executeOperator(vimState: VimState): Promise<VimState> { | ||
let start = vimState.cursorStartPosition; | ||
let stop = vimState.cursorPosition; | ||
let start = vimState.cursorStartPosition; | ||
let stop = vimState.cursorPosition; | ||
let recordedState = vimState.recordedState; | ||
|
||
if (!recordedState.operator) { | ||
|
@@ -752,9 +756,10 @@ export class ModeHandler implements vscode.Disposable { | |
[start, stop] = [stop, start]; | ||
} | ||
|
||
if (vimState.currentMode !== ModeName.Visual && | ||
vimState.currentMode !== ModeName.VisualLine && | ||
vimState.currentRegisterMode !== RegisterMode.LineWise) { | ||
if (vimState.currentMode !== ModeName.Visual && | ||
vimState.currentMode !== ModeName.VisualLine && | ||
vimState.currentRegisterMode !== RegisterMode.LineWise) { | ||
|
||
if (Position.EarlierOf(start, stop) === start) { | ||
stop = stop.getLeft(); | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this now, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah. Good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed on master, thanks!