]> git.gir.st - VimFx.git/blob - packages/vim.coffee
files recovered from dead machine... from now on I will commit every day
[VimFx.git] / packages / vim.coffee
1 { getCommand, maybeCommand } = require 'commands'
2 { getWindowId } = require 'utils'
3
4 MODE_NORMAL = 1
5
6
7 class Vim
8 constructor: (@window) ->
9 @mode = MODE_NORMAL
10 @keys = []
11
12 keypress: (keyInfo) ->
13 @keys.push keyInfo
14 if command = getCommand @keys
15 command @window
16 @keys = []
17 true
18 else if maybeCommand @keys
19 true
20 else
21 false
22
23 focus: (element) ->
24 @activeElement = element
25 console.log 'focus', @activeElement
26
27 blur: (element) ->
28 console.log 'blur', @activeElement
29 delete @activeElement if @activeElement == element
30
31
32
33
34 class VimBucket
35 constructor: ->
36 @vims = {}
37
38 get: (window) ->
39 id = getWindowId window
40 @vims[id] or @vims[id] = new Vim window
41
42 forget: (window) ->
43 id = getWindowId window
44 delete @vims[id] if id
45
46 exports.VimBucket = VimBucket
Imprint / Impressum