From facc3aa9a0b56b04c18e56418c7ea00947993f9e Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Fri, 22 Feb 2019 23:31:33 -0500 Subject: Disable terminal flow control This opens up C-o, C-q and C-s for key bindings without C-v. --- chat.h | 1 + term.c | 11 +++++++++++ ui.c | 1 + 3 files changed, 13 insertions(+) diff --git a/chat.h b/chat.h index b07aa42..afb32ef 100644 --- a/chat.h +++ b/chat.h @@ -145,6 +145,7 @@ enum TermEvent { TermPasteEnd, }; void termInit(void); +void termNoFlow(void); void termTitle(const char *title); void termMode(enum TermMode mode, bool set); enum TermEvent termEvent(char ch); diff --git a/term.c b/term.c index 75380ea..fea68ad 100644 --- a/term.c +++ b/term.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #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); diff --git a/ui.c b/ui.c index 9a83bfc..4db7e02 100644 --- a/ui.c +++ b/ui.c @@ -189,6 +189,7 @@ void uiInit(void) { cbreak(); noecho(); termInit(); + termNoFlow(); colorInit(); ui.status = newwin(1, COLS, 0, 0); ui.input = newpad(1, 512); -- cgit 1.4.1