diff --git a/src/highlighters.cc b/src/highlighters.cc index ee772469..65f801cb 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1820,7 +1820,7 @@ struct ForwardHighlighterApplier { auto& line = *cur_line; auto first = std::find_if(cur_atom, line.end(), [&](auto&& atom) { return atom.has_buffer_range() and atom.end() > begin; }); - if (first->type() == DisplayAtom::Range and first->begin() < begin) + if (first != line.end() and first->type() == DisplayAtom::Range and first->begin() < begin) first = ++line.split(first, begin); auto idx = first - line.begin(); diff --git a/test/regression/4927-crash-jumping-to-eol/cmd b/test/regression/4927-crash-jumping-to-eol/cmd new file mode 100644 index 00000000..9838b13c --- /dev/null +++ b/test/regression/4927-crash-jumping-to-eol/cmd @@ -0,0 +1 @@ + diff --git a/test/regression/4927-crash-jumping-to-eol/in b/test/regression/4927-crash-jumping-to-eol/in new file mode 100644 index 00000000..47a9f72b --- /dev/null +++ b/test/regression/4927-crash-jumping-to-eol/in @@ -0,0 +1,4 @@ +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + + + diff --git a/test/regression/4927-crash-jumping-to-eol/rc b/test/regression/4927-crash-jumping-to-eol/rc new file mode 100644 index 00000000..625de101 --- /dev/null +++ b/test/regression/4927-crash-jumping-to-eol/rc @@ -0,0 +1,3 @@ +add-highlighter global/ column 60 red +add-highlighter buffer/regions regions +add-highlighter buffer/regions/ default-region fill green