diff options
Diffstat (limited to 'src/nvim/tui/term_input.inl')
-rw-r--r-- | src/nvim/tui/term_input.inl | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/nvim/tui/term_input.inl b/src/nvim/tui/term_input.inl index 544fe8b12c..d25cbb7ba1 100644 --- a/src/nvim/tui/term_input.inl +++ b/src/nvim/tui/term_input.inl @@ -257,23 +257,11 @@ static TermInput *term_input_new(void) rv->paste_enabled = false; rv->in_fd = 0; - // Set terminal encoding based on environment(taken from libtermkey source - // code) - const char *e; - int flags = 0; - if (((e = os_getenv("LANG")) || (e = os_getenv("LC_MESSAGES")) - || (e = os_getenv("LC_ALL"))) && (e = strchr(e, '.')) && e++ && - (strcasecmp(e, "UTF-8") == 0 || strcasecmp(e, "UTF8") == 0)) { - flags |= TERMKEY_FLAG_UTF8; - } else { - flags |= TERMKEY_FLAG_RAW; - } - const char *term = os_getenv("TERM"); if (!term) { term = ""; // termkey_new_abstract assumes non-null (#2745) } - rv->tk = termkey_new_abstract(term, flags); + rv->tk = termkey_new_abstract(term, 0); int curflags = termkey_get_canonflags(rv->tk); termkey_set_canonflags(rv->tk, curflags | TERMKEY_CANON_DELBS); // setup input handle @@ -302,3 +290,10 @@ static void term_input_destroy(TermInput *input) event_poll(0); // Run once to remove references to input/timer handles xfree(input); } + +static void term_input_set_encoding(TermInput *input, char* enc) +{ + int enc_flag = strcmp(enc, "utf-8") == 0 ? TERMKEY_FLAG_UTF8 + : TERMKEY_FLAG_RAW; + termkey_set_flags(input->tk, enc_flag); +} |