     $el.css {background}
     if background
       setTimeout (-> flash $el,''), 50
+  bell = -> flash ($ 'body'), 'black'
 
   matr = rend (Matr
     rows:[]

    #   )
    #   document.title = "Matri"  # XX  debug
    # later {mod, key}

      when 'ctrl' then switch key.str || key.act
        when 'a','left'  then update cursor: 0
        when 'e','right' then update cursor: mapr.input.length
        when 'l' then update rows: []
        when 'entr' then peer act: 'bel'
        when 'w' then eatKyev ['alt'], act:'baxp'
        when 'p' then eatKyev [], act: 'up'
        when 'n' then eatKyev [], act: 'down'
        when 'b' then eatKyev [], act: 'left'
        when 'f' then eatKyev [], act: 'right'
        when 'g' then bell()
        when 't'
          if mapr.cursor is 0 or mapr.input.length < 2
            return bell()
          cursor = mapr.cursor
          if cursor < mapr.input.length
            cursor++
          doEdit [{del:cursor-1},ins:{at:cursor-2,cha:mapr.input[cursor-1]}]
          update {cursor}
        when 'u' 
          yank = mapr.input.slice(0,mapr.cursor)
          doEdit (del:mapr.cursor - n for n in [1..mapr.cursor])
        when 'k'
          yank = mapr.input.slice(mapr.cursor)
          doEdit (del:mapr.cursor for _ in [mapr.cursor...mapr.input.length])
        when 'y'
          doEdit (ins: {cha, at: mapr.cursor + n} for cha,n in yank)
        else console.log mod, str key
      when 'alt' then switch key.str || key.act
        when 'f','right'
          rest = mapr.input.slice(mapr.cursor)
          rest = rest.match(/\W*\w*/)[0] # XX unicode
          update cursor: mapr.cursor + rest.length
        when 'b','left'
          prev = mapr.input.slice(0,mapr.cursor)
          prev = prev.split('').reverse().join('')  # XX
          prev = prev.match(/\W*\w*/)[0] # XX unicode
          update cursor: mapr.cursor - prev.length
        when 'baxp'
          prev = mapr.input.slice(0,mapr.cursor)
          prev = prev.split('').reverse().join('')  # XX
          prev = prev.match(/\W*\w*/)[0] # XX unicode
          yank = prev
          doEdit (del: mapr.cursor-1 - n for _,n in prev)
      else console.log mod, str key

  Mousetrap.handleKey = (char, mod, e)->
    norm = {
      capslock:  'caps'
      pageup:    'pgup'
      pagedown:  'pgdn'
      backspace: 'baxp'
      enter:     'entr'
    }

    key = switch
      when char.length is 1
        if e.type is 'keypress'
          chac = char.charCodeAt(0)
          if chac < 32          # normalize ctrl keys
            char = String.fromCharCode chac | 96
          str: char
      when e.type is 'keydown'
        if char isnt 'space'
          act: norm[char] ? char
      when e.type is 'keyup' and norm[key] is 'caps'
        act: 'uncap'
    if !key then return
    if key.act and key.act in mod
      return
    e.preventDefault()
    #[fore, aft] = (
    #  [sli,cur] = [mapr.input.slice, mapr.cursor]
    #  [sli(0, cur), sli(cur)]
    #)
    eatKyev mod, key

    #amod = (arr)->
    #  for i in arr
