From 5c328c7a8801d6a4aded769092ead9715d4ecf98 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 2 Feb 2020 19:34:35 -0500 Subject: Remove term.c in favor of more curses APIs --- ui.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'ui.c') diff --git a/ui.c b/ui.c index f434289..5d626ce 100644 --- a/ui.c +++ b/ui.c @@ -25,7 +25,9 @@ #include #include #include +#include #include +#include #include #include @@ -125,6 +127,23 @@ static struct Window *windowFor(size_t id) { return window; } +enum { + KeyFocusIn = KEY_MAX + 1, + KeyFocusOut, + KeyPasteOn, + KeyPasteOff, +}; + +static void disableFlowControl(void) { + struct termios term; + int error = tcgetattr(STDOUT_FILENO, &term); + if (error) err(EX_OSERR, "tcgetattr"); + term.c_iflag &= ~IXON; + term.c_cc[VDISCARD] = _POSIX_VDISABLE; + error = tcsetattr(STDOUT_FILENO, TCSADRAIN, &term); + if (error) err(EX_OSERR, "tcsetattr"); +} + static void errExit(int eval) { (void)eval; reset_shell_mode(); @@ -134,15 +153,20 @@ void uiInit(void) { initscr(); cbreak(); noecho(); - termNoFlow(); + disableFlowControl(); def_prog_mode(); err_set_exit(errExit); - colorInit(); + if (!to_status_line && !strncmp(termname(), "xterm", 5)) { to_status_line = "\33]2;"; from_status_line = "\7"; } + define_key("\33[I", KeyFocusIn); + define_key("\33[O", KeyFocusOut); + define_key("\33[200~", KeyPasteOn); + define_key("\33[201~", KeyPasteOff); + colorInit(); status = newwin(1, COLS, 0, 0); input = newpad(1, InputCols); keypad(input, true); -- cgit 1.4.0 t type='hidden' name='h' value='catgirl'/>
Commit message (Expand)Author
2020-02-11Use time_t for save signatureJune McEnroe
2020-02-11Set self.nick to * initiallyJune McEnroe
2020-02-11Define ColorCap instead of hardcoding 100June McEnroe
2020-02-11Move hash to top of chat.hJune McEnroe
2020-02-11Move base64 out of chat.hJune McEnroe
2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe
2020-02-11Fix whois idle unit calculationJune McEnroe
2020-02-11Cast towupper to wchar_tJune McEnroe
2020-02-11Cast set but unused variables to voidJune McEnroe
2020-02-11Declare strlcatJune McEnroe
2020-02-11Check if VDSUSP existsJune McEnroe
2020-02-11Fix completeReplace iterationJune McEnroe
2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe
2020-02-11Remove legacy codeJune McEnroe
2020-02-11Add INSTALLING section to READMEJune McEnroe