diff options
| author | Maxime Coste <mawww@kakoune.org> | 2022-10-17 17:46:26 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2022-10-17 17:48:39 +1100 |
| commit | 287217b98715faaddab019f4e17ab54fccaaec70 (patch) | |
| tree | 5eeed3d98eb645f242a6f02033ac1e1be7936c69 /src/display_buffer.cc | |
| parent | 360a6847be5c79a57da73c15efbbb954cd8ba749 (diff) | |
Fix splitting of display atoms accross multi-columns codepoint
Honor the split request by inserting an empty atom to make sure
client code can assume splitting does replace one atom with two
Fixes #4753
Diffstat (limited to 'src/display_buffer.cc')
| -rw-r--r-- | src/display_buffer.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/display_buffer.cc b/src/display_buffer.cc index 335fb5de..c9b74d04 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -108,6 +108,10 @@ DisplayLine::iterator DisplayLine::split(iterator it, ColumnCount count) auto pos = utf8::advance(get_iterator(it->buffer(), it->begin()), get_iterator(it->buffer(), it->end()), count).coord(); + if (pos == it->begin()) // Can happen if we try to split in the middle of a multi-column codepoint + return m_atoms.insert(it, {it->buffer(), {pos, pos}, it->face}); + if (pos == it->end()) + return std::prev(m_atoms.insert(std::next(it), {it->buffer(), {pos, pos}, it->face})); return split(it, pos); } |
