fix(readline): correct function to count len of prompt to accomodate east asian characters

cancel-commander
TorchedSammy 2022-08-30 22:37:21 -04:00
parent a1410ae7ad
commit a1ce2ecba6
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 1 additions and 2 deletions

View File

@ -4,7 +4,6 @@ import (
"fmt"
ansi "github.com/acarl005/stripansi"
"github.com/rivo/uniseg"
)
// SetPrompt will define the readline prompt string.
@ -209,7 +208,7 @@ func (rl *Instance) colorizeVimPrompt(p []rune) (cp []rune) {
// getting its real-printed length.
func getRealLength(s string) (l int) {
stripped := ansi.Strip(s)
return uniseg.GraphemeClusterCount(stripped)
return getWidth([]rune(stripped))
}
func (rl *Instance) echoRightPrompt() {