tui/input.c: Use default 'ttimeoutlen' if option get fails.

Should never happen, but better to be explicit.

Helped-by: oni-link <knil.ino@gmail.com>
This commit is contained in:
Justin M. Keyes 2017-04-23 22:06:02 +02:00
parent 3fbc660d57
commit e2936ed397

View File

@ -223,10 +223,12 @@ static int get_key_code_timeout(void)
{ {
Integer ms = -1; Integer ms = -1;
// Check 'ttimeout' to determine if we should send ESC after 'ttimeoutlen'. // Check 'ttimeout' to determine if we should send ESC after 'ttimeoutlen'.
// See :help 'ttimeout' for more information
Error err = ERROR_INIT; Error err = ERROR_INIT;
if (nvim_get_option(cstr_as_string("ttimeout"), &err).data.boolean) { if (nvim_get_option(cstr_as_string("ttimeout"), &err).data.boolean) {
ms = nvim_get_option(cstr_as_string("ttimeoutlen"), &err).data.integer; Object rv = nvim_get_option(cstr_as_string("ttimeoutlen"), &err);
if (!ERROR_SET(&err)) {
ms = rv.data.integer;
}
} }
api_clear_error(&err); api_clear_error(&err);
return (int)ms; return (int)ms;