From cee756e2c110f98681f3e9f4283e44bf1963999b Mon Sep 17 00:00:00 2001 From: Paolo Ricciuti Date: Fri, 31 Jul 2026 04:53:31 +0200 Subject: [PATCH] fix: arrow up history entries (#77) Closes #76 Session history was recorded only after receiving `IRIS_CMD_STOP`. Directly launched Bash sessions may not install that completion hook, and Bash does not flush `.bash_history` until the shell exits. There was also a race where `Enter` was sent to the shell before Iris stored the submitted command, allowing fast commands to finish before the command was captured. The fix is - Record commands in session history immediately when they are submitted. - Store the submitted command before sending Enter to the shell. - Keep command-completion handling responsible for exit-code and frecency data. Once again (and please tell me if you prefer not) I'm not fluent in `go` so this was all Sol --- root/wrapper.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/root/wrapper.go b/root/wrapper.go index 3fc251a..fd8c742 100644 --- a/root/wrapper.go +++ b/root/wrapper.go @@ -411,7 +411,6 @@ func runWrapper() { lastSubmittedCommand = "" bufferMu.Unlock() if cmdToRecord != "" { - integration.RecordSessionCommand(cmdToRecord) cwd := spec.GetCWD() prevSkeleton, prevCwd := getPrevRecordedInfo() currSkeleton := scoring.ExtractSkeleton(cmdToRecord) @@ -943,13 +942,14 @@ func runWrapper() { continue } - isCommandActive.Store(true) - _, _ = ptmx.Write([]byte{b}) + integration.RecordSessionCommand(cmdToSubmit) bufferMu.Lock() lastSubmittedCommand = strings.TrimSpace(cmdToSubmit) naiveBuffer = "" cursorOffset = 0 bufferMu.Unlock() + isCommandActive.Store(true) + _, _ = ptmx.Write([]byte{b}) disableGhostText.Store(false) shouldOverlayDraw = false userNavigated.Store(false)