Permalink
Browse files

fixed: can't input numbers on emergency mode

  • Loading branch information...
1 parent c611189 commit faee0d02cd2c797090dd4e67e9ffc574b4f517e1 @k2nr committed Jan 6, 2012
Showing with 35 additions and 11 deletions.
  1. +7 −4 coffee/command.coffee
  2. +2 −0 coffee/mode.coffee
  3. +1 −0 coffee/model.coffee
  4. +14 −6 command.js
  5. +8 −0 mode.js
  6. +3 −1 model.js
View
@@ -178,7 +178,7 @@ class g.CommandExecuter
class g.CommandManager
keyQueue :
- init : (@model, @timeout, @enableMulti=true)->
+ init : (@model, @timeout, @useNumPrefix=true)->
@a = ""
@times = ""
@timerId = 0
@@ -197,7 +197,7 @@ class g.CommandManager
@timerId = setTimeout( callback, ms )
queue : (s) ->
- if @enableMulti and s.length == 1 and s.search(/[0-9]/) >= 0 and @a.length == 0
+ if @useNumPrefix and s.length == 1 and s.search(/[0-9]/) >= 0 and @a.length == 0
@times += s
else
@a += s
@@ -232,8 +232,10 @@ class g.CommandManager
@reset()
null
- constructor : (@model, timeout, enableMulti=true) ->
- @keyQueue.init( @model, timeout, enableMulti )
+ setUseNumPrefix : (@useNumPrefix) -> this
+
+ constructor : (@model, timeout, useNumPrefix=true) ->
+ @keyQueue.init( @model, timeout, useNumPrefix )
getCommandFromKeySeq : (s, keyMap) ->
@keyQueue.queue(s)
@@ -244,6 +246,7 @@ class g.CommandManager
reset : -> @keyQueue.reset()
isWaitingNextKey : -> @keyQueue.isWaiting()
+ setUseNumPrefix : (use) -> @keyQueue.setUseNumPrefix( use )
handleKey : (msg, keyMap) ->
s = g.KeyManager.getKeyCodeStr(msg)
View
@@ -4,6 +4,7 @@ g = this.vichrome
class g.Mode
exit : ->
enter : ->
+ getUseNumPrefix : -> false
enterInteractiveOpen : (baseCom, opt)->
dscr = baseCom
sources = []
@@ -191,6 +192,7 @@ class g.Mode
class g.NormalMode extends g.Mode
getName : -> "NormalMode"
+ getUseNumPrefix : -> true
prePostKeyEvent : (key, ctrl, alt, meta) -> true
escape : ->
g.model.cancelSearchHighlight()
View
@@ -90,6 +90,7 @@ g.model =
if @curMode? then @curMode.exit()
@curMode = newMode
@curMode.enter()
+ @commandManager?.setUseNumPrefix( @curMode.getUseNumPrefix() )
init : ->
@enterNormalMode()
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit faee0d0

Please sign in to comment.