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

Refactor commands [WIP] #234

Merged
merged 57 commits into from
Jun 5, 2016
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
83afbcf
Begin command refactor.
johnfn May 29, 2016
13fdd4c
Add the remaining keys.
johnfn May 29, 2016
f160a86
Passing most tests.
johnfn May 29, 2016
49b8a2f
Finish up normal mode rewrite.
johnfn May 29, 2016
7675cb6
Refactor actions to return positions.
johnfn May 29, 2016
bf5c42e
Refactor Normal & Visual mode to use same actions
johnfn May 29, 2016
7d15fff
Rewrite modes to take Actions, not key presses.
johnfn May 29, 2016
ee15155
Make operators inherit from a common base class.
johnfn May 29, 2016
409822f
Track action state in ModeHandler and write core processing fn.
johnfn May 30, 2016
a6d01bd
Remove a bunch of stuff.
johnfn May 30, 2016
c6db2d5
Respect modes for actions.
johnfn May 30, 2016
0b52969
Make all state transitions into Actions.
johnfn May 30, 2016
06ae75f
Clean up, fix <esc>.
johnfn May 30, 2016
3f2df04
Add x/X actions.
johnfn May 30, 2016
e0eb20c
Handle a lot of weird edge cases.
johnfn May 31, 2016
97c615c
Add a special case JUST for de.
johnfn May 31, 2016
8fe79c9
Add C.
johnfn May 31, 2016
b87a41a
Shove everything in one massive class.
johnfn May 31, 2016
f6d90dd
Fix cw.
johnfn May 31, 2016
bc8d0fe
Fix cW as well.
johnfn May 31, 2016
5bde23c
Pass all [operator][motion] normal mode tests!
johnfn May 31, 2016
c3683f0
Begin adding/rewriting visual mode tests.
johnfn May 31, 2016
8a6c826
Fix all visual mode tests!
johnfn May 31, 2016
0fce025
Fix a bug with deleting in Visual Mode.
johnfn Jun 2, 2016
da30a64
Fix gg, and refactor some logic along the way.
johnfn Jun 2, 2016
e84f583
Add test for gg.
johnfn Jun 2, 2016
beef8a6
Refactor a lot of deletes to use DeleteOperator.
johnfn Jun 2, 2016
87a3d99
Make DeleteOperator inclusive/exclusive.
johnfn Jun 2, 2016
8019bbe
Remove an unused function.
johnfn Jun 2, 2016
4b43b73
Fix off-by-one in reverse ranges.
johnfn Jun 2, 2016
a9476af
Add VimState, keep track of desired column again.
johnfn Jun 2, 2016
35eefbe
Clean up desiredColumn and add test.
johnfn Jun 2, 2016
4982f4b
Nest ActionState within VimState.
johnfn Jun 2, 2016
1114f9b
Nest ActionState within VimState and return VimState from actions.
johnfn Jun 2, 2016
9e055d6
Don't pass ActionState, only VimState.
johnfn Jun 2, 2016
a6c2144
Refactor the 'ready to run' logic.
johnfn Jun 3, 2016
af00ab7
Fix dl at end of line and add test.
johnfn Jun 3, 2016
b7ecb56
Add commands like $ force desiredColumn to EOL.
johnfn Jun 3, 2016
00cad54
Handle the returned VimState in a unified way.
johnfn Jun 3, 2016
7410857
Simplify logic.
johnfn Jun 3, 2016
f9fed66
Update mode via VimState.
johnfn Jun 3, 2016
f837304
Remove unnecessary parameter.
johnfn Jun 3, 2016
0f3fa9e
Remove handleDeactivation, which caused weird bugs.
johnfn Jun 3, 2016
e905f40
Stop passing in modeHandler to actions.
johnfn Jun 3, 2016
0fc8e94
Add a bunch of commands.
johnfn Jun 3, 2016
efc6133
Add 2 more commands back.
johnfn Jun 3, 2016
37a6abb
Add x operator in visual mode.
johnfn Jun 3, 2016
1a0cbb9
Add yank and put back.
johnfn Jun 3, 2016
e0e6974
Add text object and remove concept of inclusive/exclusive motions.
johnfn Jun 4, 2016
b662bad
Totally remove position options.
johnfn Jun 4, 2016
85b6d8c
Text objects work with d/c/y!!
johnfn Jun 5, 2016
88f2e57
Add iw text object.
johnfn Jun 5, 2016
3143f14
Fix an 'aw' bug.
johnfn Jun 5, 2016
d320241
Make "aw" motion work and pass tests.
johnfn Jun 5, 2016
cab7dd4
Fix iw motion.
johnfn Jun 5, 2016
668dfa1
Add put test and pass all tests.
johnfn Jun 5, 2016
3ce1c28
Fix all tslint errors.
johnfn Jun 5, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add C.
  • Loading branch information
johnfn committed May 31, 2016
commit 8fe79c978d9fc650e900fa379b97d50573d4f5c3
27 changes: 16 additions & 11 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ class CommandEsc extends BaseCommand {
}
}


@RegisterAction
class CommandChangeToLineEnd extends BaseCommand {
modes = [ModeName.Normal];
key = "C";

public async exec(modeHandler: ModeHandler, position: Position): Promise<Position> {
const end = new Position(position.line, position.getLineEnd().character + 1, position.positionOptions);

await TextEditor.delete(new vscode.Range(position, end));
modeHandler.setCurrentModeByName(ModeName.Insert);

return position;
}
}

@RegisterAction
class CommandVInVisualMode extends BaseCommand {
modes = [ModeName.Visual];
Expand Down Expand Up @@ -632,17 +648,6 @@ class ActionChangeCurrentWordToNext {
}
}

@RegisterAction
class ActionChangeToLineEnd {
modes = [ModeName.Normal];
key = "C";

public async execAction(modeHandler: ModeHandler, position: Position): Promise<Position> {
motion.changeMode(MotionMode.Cursor);
await new ChangeOperator(modeHandler).run(motion.position, motion.position.getLineEnd());
}
}

@RegisterAction
class ActionDeleteToLineEnd {
modes = [ModeName.Normal];
Expand Down