1    type Editor
2        let os_window = app.os_window
3        app.mouse.presses.subscribe { mouse_action, control ->
4            if mouse_action == MouseAction/Press then
5                if control.command ? Some command then
6                    case command of
7                        Command/Left -> move_horizontal true
8                        Command/Right -> move_horizontal false
9                        Command/Up -> move_vertical true
10                       Command/Down -> move_vertical false
11                       Command/Rename -> rename
12                       Command/File -> create false
13                       Command/Directory -> create true
14                       Command/Remove -> remove
15                       Command/Apply -> apply
16                       Command/Revert -> revert
17                       Command/SaveAll ->
18                           apply
19                           save_all
20   
21                       Command/Crate -> ()
22                       else -> fail command@type.name
23               else
24                   fail control@type.name } |> tokens.add
25   
26       os_window.mouse_buttons.subscribe { redraw } |> tokens.add
27       os_window.mouse_positions.subscribe
28           { if os_window.mouse_state MouseButton/Left == MouseAction/Press then
29                 redraw }
30       |> tokens.add
31   
32       os_window.mouse_scrolls.subscribe { redraw } |> tokens.add
33       os_window.events.subscribe { event ->
34           if event == WindowEvent/Deiconified then
35               redraw } |> tokens.add
36   
37   end@ editor
38