-
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
Implement normal command #8896
base: master
Are you sure you want to change the base?
Implement normal command #8896
Conversation
src/transformations/execute.ts
Outdated
for (const line of resultLines) { | ||
vimState.cursorStopPosition = vimState.cursorStartPosition = | ||
TextEditor.getFirstNonWhitespaceCharOnLine(vimState.document, line.lineNumber); | ||
await modeHandler.handleMultipleKeyEvents(keystroke.value); |
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.
Is it possible to call rerunRecordedState from the second line?
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.
do you mean that dot command is working properly or not?
actually :normal .
is doing well..
|
||
override async execute(vimState: VimState): Promise<void> { | ||
const keystroke = this.keystroke; | ||
vimState.recordedState.transformer.addTransformation({ |
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.
set start/end line number to vimState.cursorStopPosition
, the logic in executeNormal will be clearer
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.
I think that not setting start/end is better, because normal command behavior with visual and normal mode are different.
for example,
- text:
aaaaa
- start position: end of line
- command:
:normal iX
executing above with visual mode, the result is Xaaaaa
.
but with normal mode, it is aaaaaX
.
to achive the difference, executeTransformations
checks setting start/end or not.
withRange
stores it as boolean.
if (withRange) {
vimState.cursorStopPosition = vimState.cursorStartPosition =
TextEditor.getFirstNonWhitespaceCharOnLine(vimState.document, line.lineNumber);
}
await modeHandler.handleMultipleKeyEvents(keystroke.value);
await vimState.setCurrentMode(Mode.Normal);
@feeiyu
if you have better idea, please tell me..
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.
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.
Can we replace startLineNumber
/endLineNumber
/withRange
with this?
range?: LineRange,
I implemented test codes. |
@J-Fields |
@J-Fields |
@s-kai273 Just one more unresolved comment: #8896 (comment) |
What this PR does / why we need it:
Which issue(s) this PR fixes
Special notes for your reviewer
it is designed referring to macro implementation.