mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	fix: prompt handling
This commit is contained in:
		
							parent
							
								
									63e33af34d
								
							
						
					
					
						commit
						237bc19f68
					
				
							
								
								
									
										7
									
								
								rl.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								rl.go
									
									
									
									
									
								
							@ -217,13 +217,12 @@ func (lr *lineReader) Read() (string, error) {
 | 
				
			|||||||
func (lr *lineReader) SetPrompt(prompt string) {
 | 
					func (lr *lineReader) SetPrompt(prompt string) {
 | 
				
			||||||
	halfPrompt := strings.Split(prompt, "\n")
 | 
						halfPrompt := strings.Split(prompt, "\n")
 | 
				
			||||||
	if len(halfPrompt) > 1 {
 | 
						if len(halfPrompt) > 1 {
 | 
				
			||||||
 | 
							lr.rl.Multiline = true
 | 
				
			||||||
		lr.rl.SetPrompt(strings.Join(halfPrompt[:len(halfPrompt) - 1], "\n"))
 | 
							lr.rl.SetPrompt(strings.Join(halfPrompt[:len(halfPrompt) - 1], "\n"))
 | 
				
			||||||
		lr.rl.MultilinePrompt = halfPrompt[len(halfPrompt) - 1:][0]
 | 
							lr.rl.MultilinePrompt = halfPrompt[len(halfPrompt) - 1:][0]
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// print cursor up ansi code
 | 
							lr.rl.Multiline = false
 | 
				
			||||||
		//fmt.Printf("\033[1A")
 | 
							lr.rl.SetPrompt(prompt)
 | 
				
			||||||
		lr.rl.SetPrompt("")
 | 
					 | 
				
			||||||
		lr.rl.MultilinePrompt = halfPrompt[len(halfPrompt) - 1:][0]
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !running {
 | 
						if !running {
 | 
				
			||||||
		lr.rl.RefreshPromptInPlace("")
 | 
							lr.rl.RefreshPromptInPlace("")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user