mirror of
https://github.com/helix-editor/helix.git
synced 2025-04-02 02:17:44 +03:00
tui buffer: Handle multi-width graphemes in set_string_anchored
We should skip zero-width graphemes and reset only long (more than 1-width) graphemes. Connects #12036
This commit is contained in:
parent
9d6ea773e9
commit
0b9701e899
1 changed files with 7 additions and 2 deletions
|
@ -349,15 +349,20 @@ impl Buffer {
|
|||
if start_index > end_index {
|
||||
break;
|
||||
}
|
||||
let width = s.width();
|
||||
if width == 0 {
|
||||
continue;
|
||||
}
|
||||
|
||||
self.content[start_index].set_symbol(s);
|
||||
self.content[start_index].set_style(style(byte_offset));
|
||||
|
||||
for i in start_index + 1..end_index {
|
||||
// Reset following cells if multi-width (they would be hidden by the grapheme):
|
||||
for i in start_index + 1..start_index + width {
|
||||
self.content[i].reset();
|
||||
}
|
||||
|
||||
start_index += s.width();
|
||||
start_index += width;
|
||||
}
|
||||
|
||||
(x, y)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue