diff options
author | bptato <nincsnevem662@gmail.com> | 2024-11-24 14:15:37 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-11-24 14:16:38 +0100 |
commit | 99c55c5931e2bbeabd11018c785fbeb54ba19f37 (patch) | |
tree | 8549905da388088bdf76ade59d9bd2c9c9b5b142 /src | |
parent | b445b3a54a471b98e59545b6416eee9484f6d945 (diff) | |
download | chawan-99c55c5931e2bbeabd11018c785fbeb54ba19f37.tar.gz |
select: fix display with multi-width chars
progress. now they only mess up coloring a bit.
Diffstat (limited to 'src')
-rw-r--r-- | src/local/select.nim | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/local/select.nim b/src/local/select.nim index 9a1c550d..76ca03c0 100644 --- a/src/local/select.nim +++ b/src/local/select.nim @@ -226,12 +226,17 @@ proc drawBorders(display: var FixedGrid; sx, ex, sy, ey: int; upmore, downmore: bool) = for y in sy .. ey: var x = 0 - while x < sx: - if display[y * display.width + x].str == "": - display[y * display.width + x].str = " " - inc x - else: - x += display[y * display.width + x].str.width() + let yi = y * display.width + while true: + if display[yi + x].str == "": + display[yi + x].str = " " + let w = display[yi + x].str.width() + if x + w > sx: + while x < sx: + display[yi + x].str = " " + inc x + break + x += w # Draw corners. let tl = if upmore: VerticalBar else: CornerTopLeft let tr = if upmore: VerticalBar else: CornerTopRight |