diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-09-30 20:32:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-30 20:32:59 +0200 |
commit | 7e46fcaf2307c8ea409f32459bd9fb4f1ae44b7b (patch) | |
tree | cab676dfb3bf83cf243fc5e78bab2f435cde7517 | |
parent | dc52458522f23a0d50c7852af7191f7a92c263cb (diff) | |
parent | dd26bd59745c9fd358624312feb315ec0f106de8 (diff) | |
download | rneovim-7e46fcaf2307c8ea409f32459bd9fb4f1ae44b7b.tar.gz rneovim-7e46fcaf2307c8ea409f32459bd9fb4f1ae44b7b.tar.bz2 rneovim-7e46fcaf2307c8ea409f32459bd9fb4f1ae44b7b.zip |
Merge pull request #11121 from bfredl/invalidcell
screen: don't crash on invalid cells being recomposed (tui_raw_line assert)
-rw-r--r-- | runtime/doc/options.txt | 8 | ||||
-rw-r--r-- | src/nvim/option_defs.h | 3 | ||||
-rw-r--r-- | src/nvim/ui_compositor.c | 14 | ||||
-rw-r--r-- | test/functional/helpers.lua | 2 |
4 files changed, 25 insertions, 2 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index d87898bb89..6b9f0380f6 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4583,6 +4583,14 @@ A jump table for the options with a short description can be found at |Q_op|. RedrawDebugRecompose guibg=Red redraw generated by the compositor itself, due to a grid being moved or deleted. + nothrottle Turn off throttling of the message grid. This is an + optimization that joins many small scrolls to one + larger scroll when drawing the message area (with + 'display' msgsep flag active). + invalid Enable stricter checking (abort) of inconsistencies + of the internal screen state. This is mosly + useful when running nvim inside a debugger (and + the test suite). *'redrawtime'* *'rdt'* 'redrawtime' 'rdt' number (default 2000) diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 08df495250..108a3dde7c 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -518,10 +518,11 @@ EXTERN long p_pyx; // 'pyxversion' EXTERN char_u *p_rdb; // 'redrawdebug' EXTERN unsigned rdb_flags; # ifdef IN_OPTION_C -static char *(p_rdb_values[]) = { "compositor", "nothrottle", NULL }; +static char *(p_rdb_values[]) = { "compositor", "nothrottle", "invalid", NULL }; # endif # define RDB_COMPOSITOR 0x001 # define RDB_NOTHROTTLE 0x002 +# define RDB_INVALID 0x004 EXTERN long p_rdt; // 'redrawtime' EXTERN int p_remap; // 'remap' diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c index 20ffc1b88e..7d3ecfa0b8 100644 --- a/src/nvim/ui_compositor.c +++ b/src/nvim/ui_compositor.c @@ -425,6 +425,15 @@ static void compose_line(Integer row, Integer startcol, Integer endcol, flags = flags & ~kLineFlagWrap; } + for (int i = skipstart; i < (endcol-skipend)-startcol; i++) { + if (attrbuf[i] < 0) { + if (rdb_flags & RDB_INVALID) { + abort(); + } else { + attrbuf[i] = 0; + } + } + } ui_composed_call_raw_line(1, row, startcol+skipstart, endcol-skipend, endcol-skipend, 0, flags, (const schar_T *)linebuf+skipstart, @@ -535,6 +544,11 @@ static void ui_comp_raw_line(UI *ui, Integer grid, Integer row, } else { compose_debug(row, row+1, startcol, endcol, dbghl_normal, false); compose_debug(row, row+1, endcol, clearcol, dbghl_clear, true); +#ifndef NDEBUG + for (int i = 0; i < endcol-startcol; i++) { + assert(attrs[i] >= 0); + } +#endif ui_composed_call_raw_line(1, row, startcol, endcol, clearcol, clearattr, flags, chunk, attrs); } diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index b29161e34c..bd36bac062 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -38,7 +38,7 @@ module.nvim_prog = ( module.nvim_set = ( 'set shortmess+=IS background=light noswapfile noautoindent' ..' laststatus=1 undodir=. directory=. viewdir=. backupdir=.' - ..' belloff= wildoptions-=pum noshowcmd noruler nomore') + ..' belloff= wildoptions-=pum noshowcmd noruler nomore redrawdebug=invalid') module.nvim_argv = { module.nvim_prog, '-u', 'NONE', '-i', 'NONE', '--cmd', module.nvim_set, '--embed'} |