fix: add back prompt global var

fixes an issue with multiline prompt overriding user's prompt
permanently
windows-fixes
TorchedSammy 2022-03-05 15:46:38 -04:00
parent a0dff5babf
commit f1dfd59c4c
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
4 changed files with 6 additions and 4 deletions

2
api.go
View File

@ -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

View File

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

View File

@ -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()

View File

@ -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 = "> "
) )