about summary refs log tree commit diff
path: root/term.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-02-22 23:31:33 -0500
committerJune McEnroe <june@causal.agency>2019-02-22 23:31:33 -0500
commitfacc3aa9a0b56b04c18e56418c7ea00947993f9e (patch)
tree51f2dd7c51344dd9dbf10999164ce4dac10525d0 /term.c
parentBind up and down arrows to scroll (diff)
downloadcatgirl-facc3aa9a0b56b04c18e56418c7ea00947993f9e.tar.gz
catgirl-facc3aa9a0b56b04c18e56418c7ea00947993f9e.zip
Disable terminal flow control
This opens up C-o, C-q and C-s for key bindings without C-v.
Diffstat (limited to 'term.c')
-rw-r--r--term.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/term.c b/term.c
index 75380ea..fea68ad 100644
--- a/term.c
+++ b/term.c
@@ -18,6 +18,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <termios.h>
+#include <unistd.h>
 
 #include "chat.h"
 
@@ -28,6 +30,15 @@ void termInit(void) {
 	xterm = term && !strncmp(term, "xterm", 5);
 }
 
+void termNoFlow(void) {
+	struct termios attr;
+	int error = tcgetattr(STDIN_FILENO, &attr);
+	if (error) return;
+	attr.c_iflag &= ~IXON;
+	attr.c_cc[VDISCARD] = _POSIX_VDISABLE;
+	tcsetattr(STDIN_FILENO, TCSANOW, &attr);
+}
+
 void termTitle(const char *title) {
 	if (!xterm) return;
 	printf("\33]0;%s\33\\", title);