summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-10-30 01:14:53 -0700
committerOri Bernstein <ori@eigenstate.org>2017-10-30 01:14:53 -0700
commit8d63735093c4267099e6597b0cea18ff03e9d355 (patch)
tree2e51376486fe1f6442c89974fd7e1b1860f319fc
parent5d1b622267b90d8541cf5764ed25fb24001c345f (diff)
downloadlibtermdraw-master.tar.gz
Stylistic tweaks.HEADmaster
-rw-r--r--term.myr9
1 files changed, 7 insertions, 2 deletions
diff --git a/term.myr b/term.myr
index 92ddc45..b038c16 100644
--- a/term.myr
+++ b/term.myr
@@ -356,7 +356,7 @@ const applyattrs = {t, sb, attr
}
const flush = {t
- var fg, bg, attr, len
+ var fg, bg, attr, len, cn
var sb, s
fg = `Palette8 -1
@@ -409,7 +409,12 @@ const flush = {t
:colorsokay
std.sbputc(sb, t.buf[i].chr)
- var cn = std.cellwidth(t.buf[i].chr)
+ cn = std.cellwidth(t.buf[i].chr)
+ /*
+ Normally, we'd advance by 1 cell, but if this is a double
+ width character, we need to advance by more. Since we don't
+ have `i` available at the start of the loop, adjust here.
+ */
if cn > 1
x += cn - 1
;;