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
This commit is contained in:
+3
-3
@@ -411,7 +411,6 @@ func runWrapper() {
|
|||||||
lastSubmittedCommand = ""
|
lastSubmittedCommand = ""
|
||||||
bufferMu.Unlock()
|
bufferMu.Unlock()
|
||||||
if cmdToRecord != "" {
|
if cmdToRecord != "" {
|
||||||
integration.RecordSessionCommand(cmdToRecord)
|
|
||||||
cwd := spec.GetCWD()
|
cwd := spec.GetCWD()
|
||||||
prevSkeleton, prevCwd := getPrevRecordedInfo()
|
prevSkeleton, prevCwd := getPrevRecordedInfo()
|
||||||
currSkeleton := scoring.ExtractSkeleton(cmdToRecord)
|
currSkeleton := scoring.ExtractSkeleton(cmdToRecord)
|
||||||
@@ -943,13 +942,14 @@ func runWrapper() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
isCommandActive.Store(true)
|
integration.RecordSessionCommand(cmdToSubmit)
|
||||||
_, _ = ptmx.Write([]byte{b})
|
|
||||||
bufferMu.Lock()
|
bufferMu.Lock()
|
||||||
lastSubmittedCommand = strings.TrimSpace(cmdToSubmit)
|
lastSubmittedCommand = strings.TrimSpace(cmdToSubmit)
|
||||||
naiveBuffer = ""
|
naiveBuffer = ""
|
||||||
cursorOffset = 0
|
cursorOffset = 0
|
||||||
bufferMu.Unlock()
|
bufferMu.Unlock()
|
||||||
|
isCommandActive.Store(true)
|
||||||
|
_, _ = ptmx.Write([]byte{b})
|
||||||
disableGhostText.Store(false)
|
disableGhostText.Store(false)
|
||||||
shouldOverlayDraw = false
|
shouldOverlayDraw = false
|
||||||
userNavigated.Store(false)
|
userNavigated.Store(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user