summaryrefslogtreecommitdiff
path: root/helpfuncs.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-02-27 07:58:00 +0300
committerGrail Finder <wohilas@gmail.com>2026-02-27 07:58:00 +0300
commita0ff384b815f525bf15e6928e9a00b7019156e41 (patch)
treed13dbc7a5ca79d3d41cf940cc78e78925d13b1eb /helpfuncs.go
parent09b5e0d08f58ff182f30b4d8c4b5a601ff14293d (diff)
Enha: shellmode within inputfield
Diffstat (limited to 'helpfuncs.go')
-rw-r--r--helpfuncs.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/helpfuncs.go b/helpfuncs.go
index d8bbd78..7b1cec9 100644
--- a/helpfuncs.go
+++ b/helpfuncs.go
@@ -426,12 +426,11 @@ func deepseekModelValidator() error {
func toggleShellMode() {
shellMode = !shellMode
+ setShellMode(shellMode)
if shellMode {
- // Update input placeholder to indicate shell mode
- textArea.SetPlaceholder("SHELL MODE: Enter command and press <Esc> to execute")
+ shellInput.SetLabel(fmt.Sprintf("[%s]$ ", cfg.FilePickerDir))
} else {
- // Reset to normal mode
- textArea.SetPlaceholder("input is multiline; press <Enter> to start the next line;\npress <Esc> to send the message. Alt+1 to exit shell mode")
+ textArea.SetPlaceholder("input is multiline; press <Enter> to start the next line;\npress <Esc> to send the message.")
}
updateStatusLine()
}
@@ -443,7 +442,11 @@ func updateFlexLayout() {
}
flex.Clear()
flex.AddItem(textView, 0, 40, false)
- flex.AddItem(textArea, 0, 10, false)
+ if shellMode {
+ flex.AddItem(shellInput, 0, 10, false)
+ } else {
+ flex.AddItem(textArea, 0, 10, false)
+ }
if positionVisible {
flex.AddItem(statusLineWidget, 0, 2, false)
}
@@ -451,6 +454,8 @@ func updateFlexLayout() {
focused := app.GetFocus()
if focused == textView {
app.SetFocus(textView)
+ } else if shellMode {
+ app.SetFocus(shellInput)
} else {
app.SetFocus(textArea)
}
@@ -515,6 +520,11 @@ func executeCommandAndDisplay(cmdText string) {
textView.ScrollToEnd()
}
colorText()
+ // Add command to history (avoid duplicates at the end)
+ if len(shellHistory) == 0 || shellHistory[len(shellHistory)-1] != cmdText {
+ shellHistory = append(shellHistory, cmdText)
+ }
+ shellHistoryPos = -1
}
// parseCommand splits command string handling quotes properly