aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-24 15:58:37 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-24 15:58:37 +0100
commita6aa8c433be95d424346dfa99dbf68e54cbf349a (patch)
tree89ccd4f28d0e0a65776bc9544f4b94eef2ec39ae
parentf33513282a2fb5e55101ef1e0c8d4387d351e42d (diff)
downloadtermo-a6aa8c433be95d424346dfa99dbf68e54cbf349a.tar.gz
termo-a6aa8c433be95d424346dfa99dbf68e54cbf349a.tar.xz
termo-a6aa8c433be95d424346dfa99dbf68e54cbf349a.zip
Always load the CSI driver because it contains cross-terminal mouse and CSI u handling
-rw-r--r--driver-csi.c17
-rw-r--r--t/02getkey.c10
-rw-r--r--t/30mouse.c3
3 files changed, 10 insertions, 20 deletions
diff --git a/driver-csi.c b/driver-csi.c
index 25932a2..f9a8d6d 100644
--- a/driver-csi.c
+++ b/driver-csi.c
@@ -140,23 +140,6 @@ static int register_keys(void)
static void *new_driver(TermKey *tk, const char *term)
{
- if(strncmp(term, "xterm", 5) == 0) {
- // We want "xterm" or "xtermc" or "xterm-..."
- if(term[5] != 0 && term[5] != '-' && term[5] != 'c')
- return NULL;
- }
- else if(strcmp(term, "screen") == 0) {
- /* Also apply for screen, because it might be transporting xterm-like
- * sequences. Yes, this sucks. We shouldn't need to rely on this behaviour
- * but there's no other way to know, and if we don't then we won't
- * recognise its sequences.
- */
- }
- else
- return NULL;
-
- // Excellent - we'll continue
-
if(!keyinfo_initialised)
if(!register_keys())
return NULL;
diff --git a/t/02getkey.c b/t/02getkey.c
index f2bd299..92779b4 100644
--- a/t/02getkey.c
+++ b/t/02getkey.c
@@ -6,7 +6,7 @@ int main(int argc, char *argv[])
TermKey *tk;
TermKeyKey key;
- plan_tests(27);
+ plan_tests(31);
tk = termkey_new_abstract("vt100", 0);
@@ -61,6 +61,14 @@ int main(int argc, char *argv[])
is_int(termkey_get_buffer_remaining(tk), 256, "buffer free 256 after completion");
+ termkey_push_bytes(tk, "\033[27;5u", 7);
+
+ is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after Ctrl-Escape");
+
+ is_int(key.type, TERMKEY_TYPE_KEYSYM, "key.type after Ctrl-Escape");
+ is_int(key.code.sym, TERMKEY_SYM_ESCAPE, "key.code.sym after Ctrl-Escape");
+ is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "key.modifiers after Ctrl-Escape");
+
termkey_destroy(tk);
return exit_status();
diff --git a/t/30mouse.c b/t/30mouse.c
index f6cb707..0b069a8 100644
--- a/t/30mouse.c
+++ b/t/30mouse.c
@@ -12,8 +12,7 @@ int main(int argc, char *argv[])
plan_tests(60);
- /* vt100 doesn't have a mouse, we need xterm */
- tk = termkey_new_abstract("xterm", 0);
+ tk = termkey_new_abstract("vt100", 0);
termkey_push_bytes(tk, "\e[M !!", 6);