mirror of https://github.com/Hilbis/Hilbish
fix: prompt refresh (closes #116)
parent
eff942433d
commit
20fae8a870
|
@ -57,9 +57,9 @@ const (
|
|||
seqPosSave = "\x1b[s"
|
||||
seqPosRestore = "\x1b[u"
|
||||
|
||||
seqClearLineAfer = "\x1b[0k"
|
||||
seqClearLineBefore = "\x1b[1k"
|
||||
seqClearLine = "\x1b[2k"
|
||||
seqClearLineAfer = "\x1b[0K"
|
||||
seqClearLineBefore = "\x1b[1K"
|
||||
seqClearLine = "\x1b[2K"
|
||||
seqClearScreenBelow = "\x1b[0J"
|
||||
seqClearScreen = "\x1b[2J" // Clears screen fully
|
||||
seqCursorTopLeft = "\x1b[H" // Clears screen and places cursor on top-left
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
// It also calculates the runes in the string as well as any non-printable escape codes.
|
||||
func (rl *Instance) SetPrompt(s string) {
|
||||
rl.mainPrompt = s
|
||||
rl.computePrompt()
|
||||
}
|
||||
|
||||
// RefreshPromptLog - A simple function to print a string message (a log, or more broadly,
|
||||
|
@ -68,7 +69,6 @@ func (rl *Instance) RefreshPromptLog(log string) (err error) {
|
|||
|
||||
// RefreshPromptInPlace - Refreshes the prompt in the very same place he is.
|
||||
func (rl *Instance) RefreshPromptInPlace(prompt string) (err error) {
|
||||
|
||||
// We adjust cursor movement, depending on which mode we're currently in.
|
||||
// Prompt data intependent
|
||||
if !rl.modeTabCompletion {
|
||||
|
@ -82,7 +82,7 @@ func (rl *Instance) RefreshPromptInPlace(prompt string) (err error) {
|
|||
|
||||
// Update the prompt if a special has been passed.
|
||||
if prompt != "" {
|
||||
rl.mainPrompt = prompt
|
||||
rl.SetPrompt(prompt)
|
||||
}
|
||||
|
||||
if rl.Multiline {
|
||||
|
@ -137,7 +137,7 @@ func (rl *Instance) RefreshPromptCustom(prompt string, offset int, clearLine boo
|
|||
|
||||
// Update the prompt if a special has been passed.
|
||||
if prompt != "" {
|
||||
rl.mainPrompt = prompt
|
||||
rl.SetPrompt(prompt)
|
||||
}
|
||||
|
||||
// Add a new line if needed
|
||||
|
|
Loading…
Reference in New Issue