@@ -12,30 +12,37 @@ Architecture
1212 | and control characters. Calls the corresponding | 
1313 | handlers of the `InputStreamHandel` instance. | 
1414 | | 
15-  | e.g. Translate '\x1b[6~' into "page_down ", call the  | 
16-  | `page_down` function  of `InputStreamHandler`  | 
15+  | e.g. Translate '\x1b[6~' into "Keys.PageDown ", call | 
16+  | the `feed_key` method  of `InputProcessor`.   | 
1717 +---------------------------------------------------------------+ 
1818 | 
1919 v 
2020 +---------------------------------------------------------------+ 
2121 | InputStreamHandler | 
2222 | ================== | 
23-  | - Implements keybindings for control keys, arrow | 
24-  | movement, escape, etc... There are two classes | 
25-  | inheriting from this, which implement more | 
26-  | specific key bindings. | 
27-  | * `EmacsInputStreamHandler` | 
28-  | * `ViInputStreamHandler` | 
29-  | Keybindings are implemented as operations of the | 
30-  | `Line` object. | 
23+  | - Has a `Registry` of key bindings, it calls the | 
24+  | bindings according to the received keys and the | 
25+  | input mode. | 
3126 | | 
32-  | e.g. 'ctrl_t' calls the | 
33-  | `swap_characters_before_cursor` method of | 
34-  | the `Line` object. | 
27+  | We have Vi and Emacs bindings. 
3528 +---------------------------------------------------------------+ 
3629 | 
3730 v 
3831 +---------------------------------------------------------------+ 
32+  | Key bindings | 
33+  | ============ | 
34+  | - Every key binding consists of a function that | 
35+  | receives an `Event` and usually it operates on | 
36+  | the `Line` object. (It could insert data or move | 
37+  | the cursor for example.) | 
38+  +---------------------------------------------------------------+ 
39+  | 
40+  | Most of the key bindings operate on a `Line` object, but 
41+  | they don't have to. They could also change the visibility 
42+  | of a menu for instance, or change the color scheme. 
43+  | 
44+  v 
45+  +---------------------------------------------------------------+ 
3946 | Line | 
4047 | ==== | 
4148 | - Contains a data structure to hold the current | 
@@ -55,46 +62,33 @@ Architecture
5562 | +-----------------------------------------------+ | 
5663 +---------------------------------------------------------------+ 
5764 | 
58-  | `Line` creates a `RenderContext` instance which holds the 
59-  | information to visualise the command line. This is passed 
60-  | to the `Renderer` object. (Passing this object happens at 
61-  | various places.) 
62-  | 
63-  | +---------------+ +-------------------------------+ 
64-  | | RenderContext | | Prompt | 
65-  | | ============= | --> | ====== | 
66-  | | | | - Responsible for the | 
67-  | | | | "prompt" (The leading text | 
68-  | | | | before the actual input.) | 
69-  | | | | | 
70-  | | | | Further it actually also | 
71-  | | | | implements the trailing | 
72-  | | | | text, which could be a | 
73-  | | | | context sentsitive help | 
74-  | | | | text. | 
75-  | | | +-------------------------------+ 
76-  | | | 
77-  | | | +-------------------------------+ 
78-  | | | -> | Code | 
79-  | | | | ==== | 
80-  | | | | - Implements the semantics | 
81-  | | | | of the command line. This | 
82-  | | | | are two major things: | 
83-  | | | | | 
84-  | | | | * tokenizing the input | 
85-  | | | | for highlighting. | 
86-  | | | | * Autocompletion | 
87-  | +---------------+ +-------------------------------+ 
65+  | Normally after every key press, the output will be 
66+  | rendered again. This happens in the event loop of 
67+  | the `CommandLineInterface` where `Renderer.render` is 
68+  | called. 
69+  v 
70+  +---------------------------------------------------------------+ 
71+  | Layout | 
72+  | ====== | 
73+  | - When the renderer should redraw, the renderer | 
74+  | asks the layout what the output should look like. | 
75+  | - The layout operates on a `Screen` object that he | 
76+  | received from the `Renderer` and will put the | 
77+  | toolbars, menus, highlighted content and prompt | 
78+  | in place. | 
79+  | | 
80+  | +-----------------------------------------------+ | 
81+  | | Menus, toolbars, prompt | | 
82+  | | ======================= | | 
83+  | | | | 
84+  | +-----------------------------------------------+ | 
85+  +---------------------------------------------------------------+ 
8886 | 
89-  | The methods from `Prompt` and `Code` which are meant for 
90-  | the renderer return a list of (Token, text) tuples, where 
91-  | `Token` is a Pygments token. 
9287 v 
9388 +---------------------------------------------------------------+ 
9489 | Renderer | 
9590 | ======== | 
96-  | - Responsible for painting the (Token, text) tuples | 
97-  | to the terminal output. | 
91+  | - Calculates the difference between the last output | 
92+  | and the new one and writes it to the terminal | 
93+  | output. | 
9894 +---------------------------------------------------------------+ 
99- 
100- 
0 commit comments