aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demo.c2
-rw-r--r--termkey.c2
-rw-r--r--termkey.h.in3
-rw-r--r--termkey_new.33
4 files changed, 7 insertions, 3 deletions
diff --git a/demo.c b/demo.c
index cf2e07c..290327d 100644
--- a/demo.c
+++ b/demo.c
@@ -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");
diff --git a/termkey.c b/termkey.c
index add7a53..6b8b8ee 100644
--- a/termkey.c
+++ b/termkey.c
@@ -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