diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2022-09-28 09:28:15 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2022-09-28 09:41:18 +0200 |
commit | 6427dc8ab66e5885c133698e3e96e82ab74a89f3 (patch) | |
tree | 7c267a2db8e71709b055d62f479fe1f9dedf3d01 | |
parent | e6c214033a4fadf60faf99e95f8e9787e3c5e630 (diff) | |
download | rneovim-6427dc8ab66e5885c133698e3e96e82ab74a89f3.tar.gz rneovim-6427dc8ab66e5885c133698e3e96e82ab74a89f3.tar.bz2 rneovim-6427dc8ab66e5885c133698e3e96e82ab74a89f3.zip |
build(deps): require libtermkey version 0.22
Reduces #ifdef code.
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/nvim/tui/input.c | 4 | ||||
-rw-r--r-- | src/nvim/tui/input.h | 2 | ||||
-rw-r--r-- | src/nvim/tui/tui.c | 8 |
4 files changed, 3 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 81a0a2f667..034c349c9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -498,7 +498,7 @@ if(FEAT_TUI) add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM) endif() - find_package(LibTermkey 0.18 REQUIRED) + find_package(LibTermkey 0.22 REQUIRED) include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS}) endif() diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 998e8cfed0..fbeca26274 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -159,14 +159,10 @@ void tinput_init(TermInput *input, Loop *loop) term = ""; // termkey_new_abstract assumes non-null (#2745) } -#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18 input->tk = termkey_new_abstract(term, TERMKEY_FLAG_UTF8 | TERMKEY_FLAG_NOSTART); termkey_hook_terminfo_getstr(input->tk, input->tk_ti_hook_fn, NULL); termkey_start(input->tk); -#else - input->tk = termkey_new_abstract(term, TERMKEY_FLAG_UTF8); -#endif int curflags = termkey_get_canonflags(input->tk); termkey_set_canonflags(input->tk, curflags | TERMKEY_CANON_DELBS); diff --git a/src/nvim/tui/input.h b/src/nvim/tui/input.h index 51df57938c..0b60394850 100644 --- a/src/nvim/tui/input.h +++ b/src/nvim/tui/input.h @@ -26,9 +26,7 @@ typedef struct term_input { ExtkeysType extkeys_type; long ttimeoutlen; TermKey *tk; -#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18 TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn; ///< libtermkey terminfo hook -#endif TimeWatcher timer_handle; Loop *loop; Stream read_stream; diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 4eabecb74a..b483ad3486 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -485,9 +485,7 @@ static void tui_main(UIBridgeData *bridge, UI *ui) // TODO(bfredl): zero hl is empty, send this explicitly? kv_push(data->attrs, HLATTRS_INIT); -#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18 data->input.tk_ti_hook_fn = tui_tk_ti_getstr; -#endif tinput_init(&data->input, &tui_loop); tui_terminal_start(ui); @@ -2278,7 +2276,6 @@ static void flush_buf(UI *ui) data->overflow = false; } -#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18 /// Try to get "kbs" code from stty because "the terminfo kbs entry is extremely /// unreliable." (Vim, Bash, and tmux also do this.) /// @@ -2287,14 +2284,14 @@ static void flush_buf(UI *ui) static const char *tui_get_stty_erase(void) { static char stty_erase[2] = { 0 }; -# if defined(HAVE_TERMIOS_H) +#if defined(HAVE_TERMIOS_H) struct termios t; if (tcgetattr(input_global_fd(), &t) != -1) { stty_erase[0] = (char)t.c_cc[VERASE]; stty_erase[1] = '\0'; DLOG("stty/termios:erase=%s", stty_erase); } -# endif +#endif return stty_erase; } @@ -2328,4 +2325,3 @@ static const char *tui_tk_ti_getstr(const char *name, const char *value, void *d return value; } -#endif |