Improve format for calling commands
Commands (from the Ex class) are now called with an object containing the range, arguments, vim state, ex state and editor instead of a long list of arguments.
This commit is contained in:
parent
472ec2140e
commit
af0ba7c01c
3 changed files with 58 additions and 49 deletions
|
|
@ -150,7 +150,7 @@ class Command
|
|||
|
||||
# If the command matches an existing one exactly, execute that one
|
||||
if (func = Ex.singleton()[command])?
|
||||
func(range, args)
|
||||
func({ range, args, @vimState, @exState, @editor })
|
||||
else
|
||||
# Step 8: Match command against existing commands
|
||||
matching = (name for name, val of Ex.singleton() when \
|
||||
|
|
@ -162,7 +162,7 @@ class Command
|
|||
|
||||
func = Ex.singleton()[command]
|
||||
if func?
|
||||
func(range, args)
|
||||
func({ range, args, @vimState, @exState, @editor })
|
||||
else
|
||||
throw new CommandError("Not an editor command: #{input.characters}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue