2
2
镜像自地址 https://github.com/Hilbis/Hilbish 已同步 2025-07-18 16:52:02 +00:00

fix: dont refresh prompt at startup

这个提交包含在:
TorchedSammy 2022-03-06 17:20:41 -04:00
父节点 ba67278fad
当前提交 ec886e17fa
签署人:: sammyette
GPG 密钥 ID: 904FC49417B44DCD
共有 4 个文件被更改,包括 7 次插入5 次删除

查看文件

@ -5,7 +5,7 @@ local ansikit = require 'ansikit'
local function doPrompt(fail, mode) local function doPrompt(fail, mode)
hilbish.prompt(lunacolors.format( hilbish.prompt(lunacolors.format(
'{blue}%u {cyan}%d ' .. (fail and '{red}' or '{green}') .. '' '{blue}%u {cyan}%d\n' .. (fail and '{red}' or '{green}') .. ''
)) ))
end end

查看文件

@ -163,6 +163,7 @@ func main() {
os.Exit(0) os.Exit(0)
} }
initialized = true
input: input:
for interactive { for interactive {
running = false running = false

8
rl.go
查看文件

@ -188,17 +188,17 @@ func (lr *lineReader) Read() (string, error) {
return s, err // might get another error return s, err // might get another error
} }
func (lr *lineReader) SetPrompt(prompt string) { func (lr *lineReader) SetPrompt(p string) {
halfPrompt := strings.Split(prompt, "\n") halfPrompt := strings.Split(p, "\n")
if len(halfPrompt) > 1 { if len(halfPrompt) > 1 {
lr.rl.Multiline = true 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 {
lr.rl.Multiline = false lr.rl.Multiline = false
lr.rl.SetPrompt(prompt) lr.rl.SetPrompt(p)
} }
if !running { if initialized && !running {
lr.rl.RefreshPromptInPlace("") lr.rl.RefreshPromptInPlace("")
} }
} }

查看文件

@ -17,5 +17,6 @@ var (
interactive bool interactive bool
login bool // Are we the login shell? login bool // Are we the login shell?
noexecute bool // Should we run Lua or only report syntax errors noexecute bool // Should we run Lua or only report syntax errors
initialized bool
) )