Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 73 lines (56 sloc) 3.249 kb
43d8610 @nsf NOTES file.
authored
1 Terminal input is a little bit messy. So, what's working in termbox?
2
3 1. Termbox supports only few special keys. Main reason for that, that
4 they are available on all major terminals.
5
6 Full list of functional keys:
7 F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
8 INSERT, DELETE, HOME, END, PGUP, PGDN,
9 KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
10
11 And that's it. If you don't want input problems, stick to these.
12
10c0e2e @nsf Update docs a bit.
authored
13 2. Termbox supports all major ASCII combinations, but there are some
43d8610 @nsf NOTES file.
authored
14 interesting moments. Particulary there are a lot of key clashes (few
10c0e2e @nsf Update docs a bit.
authored
15 keys or combos does the same thing). I can list all of these:
43d8610 @nsf NOTES file.
authored
16
17 CTRL+I, TAB (0x09)
18 CTRL+2, CTRL+TILDE (0x00)
19 CTRL+H, BACKSPACE (0x08)
20 CTRL+M, ENTER (0x0D)
21 CTRL+3, ESC, CTRL+[ (0x1B) [alt emits ESC too]
22 CTRL+4, CTRL+BACKSLASH (0x1C)
23 CTRL+5, CTRL+] (0x1D)
24 CTRL+7, CTRL+SLASH, CTRL+UNDERSCORE (0x1F)
25 CTRL+8, BACKSPACE2 (0x7F) [ASCII 'DELETE' key]
26
27 Some terminals emit ASCII 'DELETE' as BACKSPACE, and real BACKSPACE
28 as CTRL+BACKSPACE. The point is, it is possible that some terminals
10c0e2e @nsf Update docs a bit.
authored
29 do things in different ways. I'm not sure right now, should I fix this.
43d8610 @nsf NOTES file.
authored
30
c2a1bc8 @nsf Add README and WHEREWHAT.
authored
31 You should keep these things in mind when developing a termbox application.
32
10c0e2e @nsf Update docs a bit.
authored
33 3. Termbox supports two input parsing modes:
43d8610 @nsf NOTES file.
authored
34 - TB_INPUT_ESC - It checks known ESC sequences and if there is no match
35 0x1B (ESC) symbol is TB_KEY_ESC. Alt+<KEY> combinations don't work.
36 - TB_INPUT_ALT - It checks known ESC sequences and if there is no match
37 0x1B enables ALT modifier, and next known key event emits with
38 TB_MOD_ALT set.
39
40 You can switch between these two modes using tb_select_input_mode() func.
41
10c0e2e @nsf Update docs a bit.
authored
42 4. Termbox supports *only* the UTF-8 encoding on input and on output. Get a
43 decent terminal emulator with unicode support! Also it means that it will
44 probably work with ASCII keymaps. UTF-8 is backward compatible with ASCII.
e542ccd @nsf Add few notes to NOTES. ;-)
authored
45
10c0e2e @nsf Update docs a bit.
authored
46 5. The available color set and attribute set is restricted the same way as key
47 set. Even though there are 256-color terminals you will not be able to use
48 additional colors.
49
4899faf @nsf Mouse support note.
authored
50 6. No mouse support.. Ever. :) But I guess it will be possible to create
51 termbox-compatible GUI library which has mouse support as an extension.
52
53 7. Probably you don't want to port existing applications to this library.
e542ccd @nsf Add few notes to NOTES. ;-)
authored
54 But you might want to develop new applications with it. Despite the fact
55 that library isn't super portable and super stable like ncurses, it will
56 do the job. If you complain about different Shift+F1, Ctrl+KEY_LEFT
57 combinations and other lacking capabilites, take a look at vim! It uses
58 very strict set of default keybindings.
59
60 (http://hea-www.harvard.edu/~fine/Tech/vi.html)
61
62 As you can see, it's generally all letters, their upper-case variants, and
63 ASCII control combinations. There are even no F1, F2, F3, etc. And hey, vim
64 has pretty nice interface. But on the other hand, other programs which
65 try to clone Windows apps or DOS apps, like Midnight Commander, just
66 completly fail. MC has this ugly ESC key (via ncurses) and all other
67 issues, it's plainly unusable and ugly. I personally prefer CLI over mc
68 for example and I bet a lot of people too.
69
70 So, the point is - turn on your imagination, you can create really nice
71 interface with this tiny set of available keys (khm.. tiny? it's pretty
72 big actually!).
Something went wrong with that request. Please try again.