mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
Can enter multi-digit numeric prefixes in command mode.
This commit is contained in:
@@ -14,6 +14,9 @@ module.exports =
|
||||
|
||||
isComplete: -> @complete
|
||||
|
||||
addDigit: (digit) ->
|
||||
@count = @count * 10 + digit
|
||||
|
||||
execute: (editor) ->
|
||||
_.times @count, => @operatorToRepeat.execute(editor)
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class VimMode
|
||||
eventName = "command-mode:#{commandName}"
|
||||
@editor.on eventName, (e) =>
|
||||
possibleOperator = fn(e)
|
||||
@pushOperator(possibleOperator) if possibleOperator.execute?
|
||||
@pushOperator(possibleOperator) if possibleOperator?.execute
|
||||
|
||||
activateInsertMode: ->
|
||||
@editor.removeClass('command-mode')
|
||||
@@ -60,7 +60,10 @@ class VimMode
|
||||
|
||||
numericPrefix: (e) ->
|
||||
num = parseInt(e.keyEvent.keystroke)
|
||||
new op.NumericPrefix(num)
|
||||
if @topOperator() instanceof op.NumericPrefix
|
||||
@topOperator().addDigit(num)
|
||||
else
|
||||
@pushOperator(new op.NumericPrefix(num))
|
||||
|
||||
pushOperator: (op) ->
|
||||
@opStack.push(op)
|
||||
|
||||
Reference in New Issue
Block a user