aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2024-02-12 06:26:27 -0600
committerRobin Jarry <robin@jarry.cc>2024-02-12 13:49:14 +0100
commit6314e2dc67418141b12081bde846091e5e160702 (patch)
treef21798e32c9d43a9d7fc4d08b5f80c1da0ca9848 /app
parent57020e98b9ca22eaf2be73722abb79547674cd67 (diff)
downloadaerc-6314e2dc67418141b12081bde846091e5e160702.tar.gz
vaxis: update to v0.7.2 and update ansi parser
Update Vaxis to v0.7.2 to gain performance improvements and StyledString parsing. The Vaxis parser fully accounts for the terminal's capability to display wide characters. Use the Vaxis StyledString parser to parse and style ansi-encoded strings. Remove unneeded code and tests. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app')
-rw-r--r--app/dirlist.go26
1 files changed, 16 insertions, 10 deletions
diff --git a/app/dirlist.go b/app/dirlist.go
index 71db2b6a..d4171a74 100644
--- a/app/dirlist.go
+++ b/app/dirlist.go
@@ -10,7 +10,6 @@ import (
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib"
- "git.sr.ht/~rjarry/aerc/lib/parse"
"git.sr.ht/~rjarry/aerc/lib/state"
"git.sr.ht/~rjarry/aerc/lib/templates"
"git.sr.ht/~rjarry/aerc/lib/ui"
@@ -335,11 +334,11 @@ func (dirlist *DirectoryList) renderDir(
}
buf.Reset()
- lbuf := parse.ParseANSI(left)
- lbuf.ApplyAttrs(style)
+ lbuf := ui.StyledString(left)
+ ui.ApplyAttrs(lbuf, style)
lwidth := lbuf.Len()
- rbuf := parse.ParseANSI(right)
- rbuf.ApplyAttrs(style)
+ rbuf := ui.StyledString(right)
+ ui.ApplyAttrs(rbuf, style)
rwidth := rbuf.Len()
if lwidth+rwidth+1 > width {
@@ -347,14 +346,21 @@ func (dirlist *DirectoryList) renderDir(
rwidth = 3 * width / 4
}
lwidth = width - rwidth - 1
- right = rbuf.TruncateHead(rwidth, '…')
- left = lbuf.Truncate(lwidth-1, '…')
+ ui.TruncateHead(rbuf, rwidth)
+ right = rbuf.Encode()
+ ui.Truncate(lbuf, lwidth)
+ left = lbuf.Encode()
} else {
for i := 0; i < (width - lwidth - rwidth - 1); i += 1 {
- lbuf.Write(' ', vaxis.Style{})
+ lbuf.Cells = append(lbuf.Cells, vaxis.Cell{
+ Character: vaxis.Character{
+ Grapheme: " ",
+ Width: 1,
+ },
+ })
}
- left = lbuf.String()
- right = rbuf.String()
+ left = lbuf.Encode()
+ right = rbuf.Encode()
}
return left, right, style