diff options
| author | Curtis McEnroe | 2019-02-22 23:31:33 -0500 | 
|---|---|---|
| committer | Curtis McEnroe | 2019-02-22 23:31:33 -0500 | 
| commit | facc3aa9a0b56b04c18e56418c7ea00947993f9e (patch) | |
| tree | 51f2dd7c51344dd9dbf10999164ce4dac10525d0 | |
| parent | 200842aa64f1f66e902dc186de15e49d0dba7830 (diff) | |
Disable terminal flow control
This opens up C-o, C-q and C-s for key bindings without C-v.
| -rw-r--r-- | chat.h | 1 | ||||
| -rw-r--r-- | term.c | 11 | ||||
| -rw-r--r-- | ui.c | 1 | 
3 files changed, 13 insertions, 0 deletions
| @@ -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); @@ -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); @@ -189,6 +189,7 @@ void uiInit(void) {  	cbreak();  	noecho();  	termInit(); +	termNoFlow();  	colorInit();  	ui.status = newwin(1, COLS, 0, 0);  	ui.input = newpad(1, 512); | 
