mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-01 11:13:24 +00:00
fix(readline): correct function to count len of prompt to accomodate east asian characters
This commit is contained in:
parent
a1410ae7ad
commit
a1ce2ecba6
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user