mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
Truncate statues message from the left, not from the right
This commit is contained in:
parent
065ca648c4
commit
529944a74a
6
view.go
6
view.go
|
|
@ -70,8 +70,10 @@ func (v *View) printStatus(msg string) {
|
|||
w, h := termbox.Size()
|
||||
|
||||
width := runewidth.StringWidth(msg)
|
||||
if width > w {
|
||||
msg = runewidth.Truncate(msg, width-(width-w), "")
|
||||
for width > w {
|
||||
_, rw := utf8.DecodeRuneInString(msg)
|
||||
width = width - rw
|
||||
msg = msg[rw:]
|
||||
}
|
||||
|
||||
var pad []byte
|
||||
|
|
|
|||
Loading…
Reference in a new issue