2
2
镜像来自 https://github.com/Hilbis/Hilbish synced 2025-07-15 15:22:03 +00:00

fix: add back prompt global var

fixes an issue with multiline prompt overriding user's prompt
permanently
This commit is contained in:
TorchedSammy 2022-03-05 15:46:38 -04:00
父節點 a0dff5babf
當前提交 f1dfd59c4c
簽署人: sammyette
GPG Key ID: 904FC49417B44DCD
共有 4 個文件被更改,包括 6 次插入4 次删除

4
api.go
查看文件

@ -175,7 +175,7 @@ These will be formatted and replaced with the appropriate values.
--- @param str string --- @param str string
*/ */
func hlprompt(L *lua.LState) int { func hlprompt(L *lua.LState) int {
prompt := L.CheckString(1) prompt = L.CheckString(1)
lr.SetPrompt(fmtPrompt(prompt)) lr.SetPrompt(fmtPrompt(prompt))
return 0 return 0
@ -386,7 +386,7 @@ func hlwhich(L *lua.LState) int {
l.Push(lua.LNil) l.Push(lua.LNil)
return 1 return 1
} }
l.Push(lua.LString(path)) l.Push(lua.LString(path))
return 1 return 1
} }

查看文件

@ -71,5 +71,5 @@ func (h *fileHistory) Len() int {
} }
func (h *fileHistory) Dump() interface{} { func (h *fileHistory) Dump() interface{} {
return nil return h.items
} }

查看文件

@ -40,7 +40,7 @@ func main() {
confDir, _ = os.UserConfigDir() confDir, _ = os.UserConfigDir()
preloadPath = strings.Replace(preloadPath, "~", homedir, 1) preloadPath = strings.Replace(preloadPath, "~", homedir, 1)
sampleConfPath = strings.Replace(sampleConfPath, "~", homedir, 1) sampleConfPath = strings.Replace(sampleConfPath, "~", homedir, 1)
// i honestly dont know what directories to use for this // i honestly dont know what directories to use for this
switch runtime.GOOS { switch runtime.GOOS {
case "linux": case "linux":
@ -165,6 +165,7 @@ func main() {
input: input:
for interactive { for interactive {
lr.SetPrompt(fmtPrompt(prompt))
running = false running = false
input, err := lr.Read() input, err := lr.Read()

查看文件

@ -7,6 +7,7 @@ var (
defaultHistDir = "" defaultHistDir = ""
commonRequirePaths = "';./libs/?/init.lua;./?/init.lua;./?/?.lua'" commonRequirePaths = "';./libs/?/init.lua;./?/init.lua;./?/?.lua'"
prompt string
multilinePrompt = "> " multilinePrompt = "> "
) )