Fix highlighters being applied to empty display buffers
In some cases such as with folding we can end-up with regions not having any atoms to highlight which can trigger a crash as we assume display buffers not to be empty Fixes #4926
This commit is contained in:
parent
7027cccf82
commit
e58592f00a
|
@ -1840,6 +1840,9 @@ struct ForwardHighlighterApplier
|
|||
cur_atom = cur_line->begin();
|
||||
}
|
||||
|
||||
if (region_lines.empty())
|
||||
return;
|
||||
|
||||
region_display.compute_range();
|
||||
highlighter.highlight(context, region_display, {begin, end});
|
||||
|
||||
|
|
1
test/regression/4926-crash-with-fold-and-ranges/cmd
Normal file
1
test/regression/4926-crash-with-fold-and-ranges/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
|
4
test/regression/4926-crash-with-fold-and-ranges/in
Normal file
4
test/regression/4926-crash-with-fold-and-ranges/in
Normal file
|
@ -0,0 +1,4 @@
|
|||
{[foo]}
|
||||
{[bar]}
|
||||
{[baz]}
|
||||
%( )
|
6
test/regression/4926-crash-with-fold-and-ranges/rc
Normal file
6
test/regression/4926-crash-with-fold-and-ranges/rc
Normal file
|
@ -0,0 +1,6 @@
|
|||
declare-option range-specs fold %val{timestamp} 1.1,3.8|folded
|
||||
|
||||
add-highlighter buffer/regions regions
|
||||
add-highlighter buffer/regions/curly region \{ \} regions
|
||||
add-highlighter buffer/regions/curly/brace region \[ \] fill green
|
||||
add-highlighter buffer/fold replace-ranges fold
|
Loading…
Reference in New Issue
Block a user