fix setting up and using the terminfo data

There should be just one place that calls `setupterm()`. While refactoring
the code I also decided to not make initializing the curses subsystem a
fatal error. We now try two fallback terminal names ("ansi" and "dumb")
and if those can't be used we still end up with a usable shell.

Fixes #3850
This commit is contained in:
Kurtis Rader
2017-02-15 20:09:26 -08:00
parent 42a320064c
commit 6d02bec4c7
16 changed files with 282 additions and 237 deletions

View File

@@ -15,11 +15,12 @@
wcstring describe_char(wint_t c);
/// Initialize the terminal by calling setupterm, and set up arrays used by readch to detect escape
/// sequences for special keys.
///
/// Before calling input_init, terminfo is not initialized and MUST not be used.
int input_init();
/// Set to true when the input subsytem has been initialized.
extern bool input_initialized;
/// Set up arrays used by readch to detect escape sequences for special keys and perform related
/// initializations for our input subsystem.
void init_input();
/// free up memory used by terminal functions.
void input_destroy();
@@ -101,7 +102,4 @@ wchar_t input_function_get_code(const wcstring &name);
/// Returns a list of all existing input function names.
wcstring_list_t input_function_get_names(void);
/// Updates our idea of whether we support term256 and term24bit.
void update_fish_color_support();
#endif