diff --git a/.hilbishrc.lua b/.hilbishrc.lua index 3940c5c..cbe0884 100644 --- a/.hilbishrc.lua +++ b/.hilbishrc.lua @@ -5,7 +5,7 @@ local ansikit = require 'ansikit' local function doPrompt(fail, mode) hilbish.prompt(lunacolors.format( - '{blue}%u {cyan}%d ' .. (fail and '{red}' or '{green}') .. '∆ ' + '{blue}%u {cyan}%d\n' .. (fail and '{red}' or '{green}') .. '∆ ' )) end diff --git a/main.go b/main.go index 7adcc49..6ee6bd2 100644 --- a/main.go +++ b/main.go @@ -163,6 +163,7 @@ func main() { os.Exit(0) } + initialized = true input: for interactive { running = false diff --git a/rl.go b/rl.go index 9118f5f..9013da9 100644 --- a/rl.go +++ b/rl.go @@ -188,17 +188,17 @@ func (lr *lineReader) Read() (string, error) { return s, err // might get another error } -func (lr *lineReader) SetPrompt(prompt string) { - halfPrompt := strings.Split(prompt, "\n") +func (lr *lineReader) SetPrompt(p string) { + halfPrompt := strings.Split(p, "\n") if len(halfPrompt) > 1 { lr.rl.Multiline = true lr.rl.SetPrompt(strings.Join(halfPrompt[:len(halfPrompt) - 1], "\n")) lr.rl.MultilinePrompt = halfPrompt[len(halfPrompt) - 1:][0] } else { lr.rl.Multiline = false - lr.rl.SetPrompt(prompt) + lr.rl.SetPrompt(p) } - if !running { + if initialized && !running { lr.rl.RefreshPromptInPlace("") } } diff --git a/vars.go b/vars.go index 47ebd8c..c5c286a 100644 --- a/vars.go +++ b/vars.go @@ -17,5 +17,6 @@ var ( interactive bool login bool // Are we the login shell? noexecute bool // Should we run Lua or only report syntax errors + initialized bool )