build: Support old libtermkey.

Check TERMKEY_VERSION_* before referencing `TermKey_Terminfo_Getstr_Hook`.
This commit is contained in:
Justin M. Keyes 2016-12-24 17:28:56 +01:00
parent a3b58cd60a
commit cdcf5d2039
2 changed files with 6 additions and 1 deletions

View File

@ -12,7 +12,9 @@ typedef struct term_input {
bool paste_enabled;
bool waiting;
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;

View File

@ -200,7 +200,9 @@ static void tui_terminal_start(UI *ui)
update_size(ui);
signal_watcher_start(&data->winch_handle, sigwinch_cb, SIGWINCH);
#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18
data->input.tk_ti_hook_fn = tui_tk_ti_getstr;
#endif
term_input_init(&data->input, data->loop);
term_input_start(&data->input);
}
@ -963,6 +965,7 @@ static void flush_buf(UI *ui, bool toggle_cursor)
}
}
#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.)
///
@ -1008,4 +1011,4 @@ static const char *tui_tk_ti_getstr(const char *name, const char *value,
return value;
}
#endif