aboutsummaryrefslogtreecommitdiff
path: root/demo.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2009-11-27 15:07:05 +0000
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2009-11-27 15:07:05 +0000
commitba0c32e8d84925f88a8af540ce08b2dccbb52c25 (patch)
treedca07f3d4e6364666313e3b9be5938af04fb9198 /demo.c
parent571e5b701f4d45d7c0942206b78f4c3b3478d248 (diff)
downloadtermo-ba0c32e8d84925f88a8af540ce08b2dccbb52c25.tar.gz
termo-ba0c32e8d84925f88a8af540ce08b2dccbb52c25.tar.xz
termo-ba0c32e8d84925f88a8af540ce08b2dccbb52c25.zip
Allow formatting the mouse position when rendering an event to a string
Diffstat (limited to 'demo.c')
-rw-r--r--demo.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/demo.c b/demo.c
index fe0176f..cf2e07c 100644
--- a/demo.c
+++ b/demo.c
@@ -8,6 +8,7 @@ int main(int argc, char *argv[])
TERMKEY_CHECK_VERSION;
int mouse = 0;
+ TermKeyFormat format = TERMKEY_FORMAT_VIM;
char buffer[50];
TermKey *tk;
@@ -20,6 +21,8 @@ int main(int argc, char *argv[])
mouse = atoi(optarg);
else
mouse = 1000;
+ format |= TERMKEY_FORMAT_MOUSE_POS;
+
break;
default:
fprintf(stderr, "Usage: %s [-m]\n", argv[0]);
@@ -41,7 +44,7 @@ int main(int argc, char *argv[])
printf("\e[?%dhMouse mode active\n", mouse);
while((ret = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) {
- termkey_snprint_key(tk, buffer, sizeof buffer, &key, TERMKEY_FORMAT_VIM);
+ termkey_snprint_key(tk, buffer, sizeof buffer, &key, format);
printf("%s\n", buffer);
if(key.type == TERMKEY_TYPE_UNICODE &&