restore old 'termencoding' behavior

Partially reverts #11647. Replaces #11662

The old implementation was removed without clear motivation. The "term option"
hackaround added in its place is neither shorter nor simpler.

The new behavior breaks even init.vim that expliticly check against it:

    if exists('&termencoding')
      set termencoding=utf-8
    endif

There was nothing wrong with the 0.4.x behavior. Empty &tenc has
indicated that the &enc value should be used for all the history of
Nvim. Ignoring setting the option is the expected behavior for Vim
versions that does not support the option (and Nvim is such a version)

'tenc' was also irrelevant to the Test_unicode python3 test.
The reason this has to be disabled is that neovim can't change
internal 'encoding'
This commit is contained in:
Björn Linse 2020-01-19 08:48:35 +01:00
parent fd89ad7bfb
commit b3974e4437
3 changed files with 7 additions and 10 deletions

View File

@ -4742,13 +4742,6 @@ bool get_tty_option(char *name, char **value)
return true;
}
if (strequal(name, "tenc") || strequal(name, "termencoding")) {
if (value) {
*value = xstrdup("utf-8");
}
return true;
}
if (strequal(name, "ttytype")) {
if (value) {
*value = p_ttytype ? xstrdup(p_ttytype) : xstrdup("nvim");

View File

@ -2488,6 +2488,12 @@ return {
varname='p_tbidi',
defaults={if_true={vi=false}}
},
{
full_name='termencoding', abbreviation='tenc',
type='string', scope={'global'},
vi_def=true,
defaults={if_true={vi=""}}
},
{
full_name='termguicolors', abbreviation='tgc',
type='bool', scope={'global'},

View File

@ -175,9 +175,7 @@ endfunc
func Test_unicode()
" this crashed Vim once
if &tenc != ''
throw "Skipped: 'termencoding' is not empty"
endif
throw "Skipped: nvim does not support changing 'encoding'"
set encoding=utf32
py3 print('hello')