mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +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