From b66c8abf707e6574f6867b646dfb2549a5a7147f Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Wed, 8 Aug 2018 00:55:45 -0400 Subject: Set log marker on FocusOut event All of this needs refactoring, probably separating the line editing out from the actual input handling. --- ui.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ui.c') diff --git a/ui.c b/ui.c index cc7dcf8..937fa63 100644 --- a/ui.c +++ b/ui.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,15 @@ #define A_ITALIC A_NORMAL #endif +static void focusEnable(void) { + printf("\33[?1004h"); + fflush(stdout); +} +static void focusDisable(void) { + printf("\33[?1004l"); + fflush(stdout); +} + static void colorInit(void) { start_color(); use_default_colors(); @@ -98,6 +108,7 @@ void uiInit(void) { cbreak(); noecho(); + focusEnable(); colorInit(); ui.topic = newpad(2, TOPIC_COLS); @@ -123,6 +134,7 @@ static void uiResize(void) { } void uiHide(void) { + focusDisable(); endwin(); printf( "This program is AGPLv3 free software!\n" @@ -427,6 +439,17 @@ static void complete(void) { } static void keyChar(wint_t ch) { + static bool esc, csi; + + if (csi) { + csi = false; + if (ch == L'O') logMark(); + return; + } + csi = (esc && ch == L'['); + esc = (ch == L'\33'); + if (csi) return; + switch (ch) { break; case CTRL('L'): uiRedraw(); break; case CTRL('B'): reject(); left(); -- cgit 1.4.1 oc/zlib/gzgets.3'>
Commit message (Collapse)Author
2022-06-02Don't duplicate path stringJune McEnroe
2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe
For some reason I haven't been able to figure out, trying to poll /dev/tty returns POLLNVAL (and this was using 100% CPU looping), but using stderr instead works fine.
2022-06-02Add initial working version of qfJune McEnroe
2022-05-29Set prompt for okshJune McEnroe