Skip to content
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

fix #690 and other toggle case issues #698

Merged
merged 6 commits into from
Sep 5, 2016
Merged

fix #690 and other toggle case issues #698

merged 6 commits into from
Sep 5, 2016

Conversation

xconverge
Copy link
Member

Toggle case wasn't toggling interWoVen cases...

Also made it repeatable with dot and correctly

const text = TextEditor.getText(range);

let newText = "";
for (var i = 0; i < text.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you refactor out this duplicated code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I was waiting for this comment, I figured that this was better than polluting the other one with VisualBlock specific stuff.

Where would a function like this to DRY it up go?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, yeah, you know it had to happen. Maybe in a utilities file somewhere? Or if you can't find/dont want to make one, then a static method on a class can work.

Copy link
Member

@jpoon jpoon Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 static method

@@ -3537,20 +3537,55 @@ class ToggleCaseOperator extends BaseOperator {

public async run(vimState: VimState, start: Position, end: Position): Promise<VimState> {
const range = new vscode.Range(start, new Position(end.line, end.character + 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also change this to: new vscode.Range(start, end.getRight());.

Probably doesn't matter but I'd sleep better at night with the position checking.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, insomnia is no fun

@jpoon
Copy link
Member

jpoon commented Sep 2, 2016

Pending @johnfn's comment. LGTM.

@xconverge
Copy link
Member Author

Should be good to go

@jpoon
Copy link
Member

jpoon commented Sep 5, 2016

@xconverge once you merge latest from master, I can get this in.

@jpoon jpoon merged commit e7796d9 into VSCodeVim:master Sep 5, 2016
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants