diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-03-23 22:17:25 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2011-03-23 22:17:25 +0000 |
commit | a71f68dd5718a77d5a97fc6d8e2fcd816657bb3b (patch) | |
tree | 23b61e44cb9f3d4eed92a00d3c0e53b375d5121e | |
parent | ba0c32e8d84925f88a8af540ce08b2dccbb52c25 (diff) | |
download | termo-a71f68dd5718a77d5a97fc6d8e2fcd816657bb3b.tar.gz termo-a71f68dd5718a77d5a97fc6d8e2fcd816657bb3b.tar.xz termo-a71f68dd5718a77d5a97fc6d8e2fcd816657bb3b.zip |
Interpret space as Unicode by default, add a flag to make it symbolic instead
-rw-r--r-- | demo.c | 2 | ||||
-rw-r--r-- | termkey.c | 2 | ||||
-rw-r--r-- | termkey.h.in | 3 | ||||
-rw-r--r-- | termkey_new.3 | 3 |
4 files changed, 7 insertions, 3 deletions
@@ -30,7 +30,7 @@ int main(int argc, char *argv[]) } } - tk = termkey_new(0, 0); + tk = termkey_new(0, TERMKEY_FLAG_SPACESYMBOL); if(!tk) { fprintf(stderr, "Cannot allocate termkey instance\n"); @@ -447,7 +447,7 @@ static void emit_codepoint(TermKey *tk, long codepoint, TermKeyKey *key) key->type = TERMKEY_TYPE_KEYSYM; } } - else if(codepoint == 0x20 && !(tk->flags & TERMKEY_FLAG_NOINTERPRET)) { + else if(codepoint == 0x20 && (tk->flags & TERMKEY_FLAG_SPACESYMBOL)) { // ASCII space key->type = TERMKEY_TYPE_KEYSYM; key->code.sym = TERMKEY_SYM_SPACE; diff --git a/termkey.h.in b/termkey.h.in index 0adf112..8e3cad1 100644 --- a/termkey.h.in +++ b/termkey.h.in @@ -133,11 +133,12 @@ typedef struct { typedef struct _TermKey TermKey; enum { - TERMKEY_FLAG_NOINTERPRET = 1 << 0, // Do not interpret C0//G1 codes if possible + TERMKEY_FLAG_NOINTERPRET = 1 << 0, // Do not interpret C0//DEL codes if possible TERMKEY_FLAG_CONVERTKP = 1 << 1, // Convert KP codes to regular keypresses TERMKEY_FLAG_RAW = 1 << 2, // Input is raw bytes, not UTF-8 TERMKEY_FLAG_UTF8 = 1 << 3, // Input is definitely UTF-8 TERMKEY_FLAG_NOTERMIOS = 1 << 4, // Do not make initial termios calls on construction + TERMKEY_FLAG_SPACESYMBOL = 1 << 5, // Space is symbolic rather than Unicode }; void termkey_check_version(int major, int minor); diff --git a/termkey_new.3 b/termkey_new.3 index 4a7f774..c1742fc 100644 --- a/termkey_new.3 +++ b/termkey_new.3 @@ -38,6 +38,9 @@ Ignore locale settings; force UTF-8 recombining on. This flag overrides \fBTERMK Even if the terminal file descriptor \fIfd\fP represents a .SM TTY device, do not call the \fBtcsetattr\fP() \fBtermios\fP function on it to set it to canonical input mode. +.TP +.B TERMKEY_FLAG_SPACESYMBOL +Report space as being a symbolic key rather than a Unicode codepoint. .PP When the constructor is invoked, it attempts to detect if the current locale is UTF-8 aware or not, and sets either the \fBTERMKEY_FLAG_UTF8\fP or \fBTERMKEY_FLAG_RAW\fP flag. One of these two bits will always be in effect. The current flags in effect can be obtained by \fBtermkey_get_flags\fP(). .SH VERSION CHECK MACRO |