mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
multi-byte characters are overlapped in prompt message (#745)
* modified messenger.Display * modified messenger.Display
This commit is contained in:
committed by
Zachary Yedidia
parent
fbf58486fb
commit
4f8f6f1ca3
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/zyedidia/clipboard"
|
"github.com/zyedidia/clipboard"
|
||||||
"github.com/zyedidia/tcell"
|
"github.com/zyedidia/tcell"
|
||||||
|
"github.com/mattn/go-runewidth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TermMessage sends a message to the user in the terminal. This usually occurs before
|
// TermMessage sends a message to the user in the terminal. This usually occurs before
|
||||||
@@ -463,8 +464,10 @@ func (m *Messenger) Display() {
|
|||||||
if m.hasMessage {
|
if m.hasMessage {
|
||||||
if m.hasPrompt || globalSettings["infobar"].(bool) {
|
if m.hasPrompt || globalSettings["infobar"].(bool) {
|
||||||
runes := []rune(m.message + m.response)
|
runes := []rune(m.message + m.response)
|
||||||
|
posx := 0
|
||||||
for x := 0; x < len(runes); x++ {
|
for x := 0; x < len(runes); x++ {
|
||||||
screen.SetContent(x, h-1, runes[x], nil, m.style)
|
screen.SetContent(posx, h-1, runes[x], nil, m.style)
|
||||||
|
posx += runewidth.RuneWidth(runes[x])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user