input_handling
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | input_handling [2007/04/25 05:56] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ======Purpose: | ||
| + | I get many requests for utf8 support. | ||
| + | not support utf8, and support for it is not planned in the short term. | ||
| + | This document describes how epic handles your keypresses, and discusses how | ||
| + | utf8 support might grow in the future. | ||
| + | excruciatingly exacting enough to satisfy pedants, but rather to gently | ||
| + | introduce people to the issues and why console programs have a much harder | ||
| + | time of it than graphical program.s | ||
| + | |||
| + | ======How epic handles user input====== | ||
| + | =====The flow chart===== | ||
| + | 1) You press a key | ||
| + | 2) Your terminal emulator converts it to a string | ||
| + | 3) That string is sent to epic | ||
| + | 4) EPIC decomposes the string into individual characters | ||
| + | 5) Sequences of characters are accumulated to match your [[bind]]ings. | ||
| + | 6) The actions associated with your [[bind]]ings are executed. | ||
| + | |||
| + | =====Your terminal emulator and epic must agree===== | ||
| + | If your terminal emulator sends ^[[D when you press cursor left (trust me, | ||
| + | it does), then you must /bind ^[[D backward_character to get the cursor | ||
| + | left key to move the cursor back one character. | ||
| + | this way. Your emulator converts one keypress into one or more bytes, and | ||
| + | sends those bytes to the program you're running (epic). | ||
| + | |||
| + | It is important to realize that this is not magic: your emulator can send | ||
| + | whatever string it wants, and epic would not have any idea what that is. | ||
| + | However, there is historical precedent that certain keys generate certain | ||
| + | strings, and most terminal emulators use them for maximum compatability. | ||
| + | So you usually never have to think about this. It Just Works(tm). | ||
| + | |||
| + | =====EPIC receives the string===== | ||
| + | Whatever string your terminal emulator sent is received by epic as user | ||
| + | input. | ||
| + | // | ||
| + | //character sequences// which are associated with a //key binding//, | ||
| + | which performs an //action//. | ||
| + | |||
| + | =====Keybindings regroup strings back into key presses===== | ||
| + | Since pressing some keys generates multiple bytes of input, you have to | ||
| + | tell epic how to re-assemble those bytes of input back into one logical | ||
| + | character. | ||
| + | |||
| + | In our current example, you did /bind ^[[D backward_character. | ||
| + | does is tell epic to treat the character sequence ^[[D as one keypress | ||
| + | and you want it to execute the [[backward_characte]] action when you do | ||
| + | that keypress. | ||
| + | each of the three keys as individual keypresses, and do whatever action | ||
| + | each of the three were bound to! | ||
| + | |||
| + | |||
input_handling.txt · Last modified: 2007/04/25 05:56 by 127.0.0.1
