ui: disable clearing almost everywhere

Avoid clearing the screen in most situations. NOT_VALID should be
equivalent to CLEAR unless some external force messed up the terminal,
for these situations <c-l> and :mode will still clear the screen.

Also eliminate some obsolete code in screen.c, that dealt with that in
vim drawing window 1 can mess up window 2, but this never happens in
nvim.

But what about slow terminals? There is two common meanings in which
a terminal is said to be "slow":

Most commonly (and in the sense of vim:s nottyfast) it means low
bandwidth for sending bytes from nvim to the terminal. If the screen is
very similar before and after the update_screen(CLEAR) this change
should reduce bandwidth. If the screen is quite different, but there is
no new regions of contiguous whitespace, clearing doesn't reduce
bandwidth significantly. If the new screen contains a lot of whitespace,
it will depend of if vsplits are used or not: as long as there is no
vsplits, ce is used to cheaply clear the rest of the line, so
full-screen clear is not needed to reduce bandwith. However a left
vsplit currently needs to be padded with whitespace all the way to the
separator. It is possible ec (clear N chars) can be used to reduce
bandwidth here if this is a problem. (All of this assumes that one
doesn't set Normal guibg=... on a non-BCE terminal, if you do you are
doomed regardless of this change).

Slow can also mean that drawing pixels on the screen is slow. E-ink
screens is a recent example. Avoiding clearing and redrawing the
unchanged part of the screen will always improve performance in these
cases.
This commit is contained in:
Björn Linse
2018-10-20 23:43:47 +02:00
parent 565bbd1485
commit e598811e76
18 changed files with 119 additions and 185 deletions

View File

@@ -68,7 +68,7 @@ return {
type='bool', scope={'global'},
vi_def=true,
vim=true,
redraw={'everything', 'ui_option'},
redraw={'all_windows', 'ui_option'},
varname='p_arshape',
defaults={if_true={vi=true}}
@@ -92,7 +92,7 @@ return {
full_name='ambiwidth', abbreviation='ambw',
type='string', scope={'global'},
vi_def=true,
redraw={'everything', 'ui_option'},
redraw={'all_windows', 'ui_option'},
varname='p_ambw',
defaults={if_true={vi="single"}}
},
@@ -133,7 +133,7 @@ return {
full_name='background', abbreviation='bg',
type='string', scope={'global'},
vi_def=true,
redraw={'everything'},
redraw={'all_windows'},
varname='p_bg',
defaults={if_true={vi="light"}}
},
@@ -662,7 +662,7 @@ return {
full_name='emoji', abbreviation='emo',
type='bool', scope={'global'},
vi_def=true,
redraw={'everything', 'ui_option'},
redraw={'all_windows', 'ui_option'},
varname='p_emoji',
defaults={if_true={vi=true}}
},
@@ -671,7 +671,6 @@ return {
type='string', scope={'global'},
deny_in_modelines=true,
vi_def=true,
redraw={'everything'},
varname='p_enc',
defaults={if_true={vi=macros('ENC_DFLT')}}
},
@@ -1023,7 +1022,7 @@ return {
deny_duplicates=true,
vi_def=true,
varname='p_guifont',
redraw={'everything', 'ui_option'},
redraw={'ui_option'},
defaults={if_true={vi=""}}
},
{
@@ -1031,7 +1030,7 @@ return {
type='string', list='onecomma', scope={'global'},
vi_def=true,
varname='p_guifontset',
redraw={'everything', 'ui_option'},
redraw={'ui_option'},
defaults={if_true={vi=""}}
},
{
@@ -1039,7 +1038,7 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
vi_def=true,
redraw={'everything', 'ui_option'},
redraw={'ui_option'},
varname='p_guifontwide',
defaults={if_true={vi=""}}
},
@@ -1099,7 +1098,6 @@ return {
type='string', list='onecomma', scope={'global'},
deny_duplicates=true,
vi_def=true,
redraw={'everything'},
varname='p_hl',
defaults={if_true={vi=macros('HIGHLIGHT_INIT')}}
},
@@ -1195,7 +1193,7 @@ return {
full_name='inccommand', abbreviation='icm',
type='string', scope={'global'},
vi_def=true,
redraw={'everything'},
redraw={'all_windows'},
varname='p_icm',
defaults={if_true={vi=""}}
},
@@ -1399,7 +1397,7 @@ return {
full_name='linespace', abbreviation='lsp',
type='number', scope={'global'},
vi_def=true,
redraw={'everything', 'ui_option'},
redraw={'ui_option'},
varname='p_linespace',
defaults={if_true={vi=0}}
},
@@ -2428,7 +2426,6 @@ return {
full_name='termencoding', abbreviation='tenc',
type='string', scope={'global'},
vi_def=true,
redraw={'everything'},
defaults={if_true={vi=""}}
},
{