From 978dfe4bdf5d28810a69a964ba52fe1d569250ba Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 16 Feb 2021 12:32:05 +1100 Subject: Fix splitting display line in front of a replaced range When a replaced buffer range atom was starting exactly at the location we wanted to split onto the code would split *after* that atom instead of before. Fixes #4052 --- src/display_buffer.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/display_buffer.cc') diff --git a/src/display_buffer.cc b/src/display_buffer.cc index 8ade4047..b7564550 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -113,7 +113,10 @@ DisplayLine::iterator DisplayLine::split(iterator it, ColumnCount count) DisplayLine::iterator DisplayLine::split(BufferCoord pos) { - auto it = find_if(begin(), end(), [pos](const DisplayAtom& a) { return a.type() == DisplayAtom::Range and a.end() > pos; }); + auto it = find_if(begin(), end(), [pos](const DisplayAtom& a) { + return (a.has_buffer_range() && a.begin() >= pos) || + (a.type() == DisplayAtom::Range and a.end() > pos); + }); if (it == end() or it->begin() >= pos) return it; return ++split(it, pos); -- cgit v1.2.3