diff options
| author | Maxime Coste <mawww@kakoune.org> | 2023-02-15 13:04:53 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2023-02-15 13:04:53 +1100 |
| commit | afaa47e93fb937fbedb60bcdbc768bb937108f86 (patch) | |
| tree | ca6a0c67e8df72276be9c8168204d20eef59a67c /src | |
| parent | 0630b4f4f6f006702bbff973309f2487b9fab001 (diff) | |
Fix trimming of line front halfway through a double-width glyph
Insert a space to replace the half glyph and ensure the rest of the
line is correctly aligned.
Fixes #4843
Diffstat (limited to 'src')
| -rw-r--r-- | src/display_buffer.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/display_buffer.cc b/src/display_buffer.cc index 0fd180b6..d88d02fe 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -253,14 +253,18 @@ bool DisplayLine::trim_from(ColumnCount first_col, ColumnCount front, ColumnCoun } auto front_it = it; + Face last_face{}; while (front > 0 and it != end()) { front -= it->trim_begin(front); - kak_assert(it->empty() or front == 0); + kak_assert(it->empty() or front <= 0); + last_face = it->face; if (it->empty()) ++it; } - m_atoms.erase(front_it, it); + it = m_atoms.erase(front_it, it); + if (front < 0) + it = m_atoms.insert(it, DisplayAtom{String{' ', -front}, last_face}); it = begin(); for (; it != end() and col_count > 0; ++it) |
