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