-
-
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
Fixes #1256 and #394: Fixes delete key and adds functionality #1644
Conversation
src/actions/actions.ts
Outdated
@@ -2154,7 +2151,7 @@ export class ShiftYankOperatorVisual extends BaseOperator { | |||
|
|||
@RegisterAction | |||
export class DeleteOperatorXVisual extends BaseOperator { |
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.
Decided not to change the name because <Del>
is just a synonym in visual mode. Come to think of it, can't we combine d
in visual mode with this as well?
@@ -117,7 +117,7 @@ | |||
{ | |||
"key": "Delete", | |||
"command": "extension.vim_delete", | |||
"when": "editorTextFocus && vim.active && vim.mode == 'Normal' && !inDebugRepl" | |||
"when": "editorTextFocus && vim.active && !inDebugRepl" |
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.
does delete work in insert mode now?
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 it still passes through to VSCode since none of our actions capture <Del>
in InsertMode.
@Chillee sorry I can't simply rebase this one as it somehow leads to circular dependency. |
src/actions/commands/actions.ts
Outdated
return state; | ||
public async execCount(position: Position, vimState: VimState): Promise<VimState> { | ||
if (vimState.recordedState.count !== 0) { | ||
vimState.recordedState.count = Math.floor(vimState.recordedState.count / 10); |
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.
What is going on here, not sure I follow
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.
http://vimdoc.sourceforge.net/htmldoc/change.html#
What the <Del>
key does if you have a count in front of it is to remove the last number from the count. So if you typed 100<Del>
x, then you would only delete 10 characters.
So I simply divide the count by 10 (which removes the last number).
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.
Come to think of it though, this might not work so well if <Del>
is pressed when it shouldn't be pressed (in the middle of another operator for example).
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.
Yeah could we leave a comment explaining what's going on here?
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.
Just did 👍
Otherwise, this PR fixes the first part of #1256 through just adding more key capturing, and fixes the second part by setting desiredColumn in visual mode.