mirror of https://github.com/Hilbis/Hilbish
fix(readline): correct function to count len of prompt to accomodate east asian characters
parent
a1410ae7ad
commit
a1ce2ecba6
|
@ -4,7 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
ansi "github.com/acarl005/stripansi"
|
ansi "github.com/acarl005/stripansi"
|
||||||
"github.com/rivo/uniseg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetPrompt will define the readline prompt string.
|
// SetPrompt will define the readline prompt string.
|
||||||
|
@ -209,7 +208,7 @@ func (rl *Instance) colorizeVimPrompt(p []rune) (cp []rune) {
|
||||||
// getting its real-printed length.
|
// getting its real-printed length.
|
||||||
func getRealLength(s string) (l int) {
|
func getRealLength(s string) (l int) {
|
||||||
stripped := ansi.Strip(s)
|
stripped := ansi.Strip(s)
|
||||||
return uniseg.GraphemeClusterCount(stripped)
|
return getWidth([]rune(stripped))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rl *Instance) echoRightPrompt() {
|
func (rl *Instance) echoRightPrompt() {
|
||||||
|
|
Loading…
Reference in New Issue