Merge pull request #11126 from bfredl/invalidcell-0.4
[release-0.4] screen: don't crash on invalid grid cells being recomposed
This commit is contained in:
commit
60b56ed458
|
@ -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)
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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'}
|
||||
|
|
Loading…
Reference in New Issue