summaryrefslogtreecommitdiff
path: root/src/display_buffer.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-02-16 12:32:05 +1100
committerMaxime Coste <mawww@kakoune.org>2021-02-16 12:35:25 +1100
commit978dfe4bdf5d28810a69a964ba52fe1d569250ba (patch)
treeeb6726bcf06457bd79ea006bcacbd72e382a94dc /src/display_buffer.cc
parentfa3aa3c1a34b80efc7680939c4c65496dc91a54f (diff)
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
Diffstat (limited to 'src/display_buffer.cc')
-rw-r--r--src/display_buffer.cc5
1 files changed, 4 insertions, 1 deletions
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);