fix: add user input to history instead of hilbish expanded (closes #103)

windows-fixes
TorchedSammy 2022-03-07 19:10:21 -04:00
parent 738939e4c9
commit 853dfa369f
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ import (
"time" "time"
"hilbish/util" "hilbish/util"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
"mvdan.cc/sh/v3/shell" "mvdan.cc/sh/v3/shell"
//"github.com/yuin/gopher-lua/parse" //"github.com/yuin/gopher-lua/parse"
@ -245,7 +245,7 @@ func splitInput(input string) ([]string, string) {
func cmdFinish(code uint8, cmdstr, oldInput string) { func cmdFinish(code uint8, cmdstr, oldInput string) {
// if input has space at the beginning, dont put in history // if input has space at the beginning, dont put in history
if !strings.HasPrefix(oldInput, " ") || interactive { if !strings.HasPrefix(oldInput, " ") || interactive {
handleHistory(cmdstr) handleHistory(strings.TrimSpace(oldInput))
} }
util.SetField(l, hshMod, "exitCode", lua.LNumber(code), "Exit code of last exected command") util.SetField(l, hshMod, "exitCode", lua.LNumber(code), "Exit code of last exected command")
hooks.Em.Emit("command.exit", code, cmdstr) hooks.Em.Emit("command.exit", code, cmdstr)