feat: ctrl+o toggles tool output expand, fix auto default

- ctrl+o toggles between 10-line truncated and full tool output
- Label shows "ctrl+o to expand" (lowercase)
- Fixed: auto permission mode now sticks — config default was
  overriding flag default ("default" → "auto" in config defaults)
This commit is contained in:
2026-04-03 19:00:59 +02:00
parent 4847421b17
commit ec9a918da9
2 changed files with 9 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ func Defaults() Config {
Endpoints: make(map[string]string),
},
Permission: PermissionSection{
Mode: "default",
Mode: "auto",
},
Tools: ToolsSection{
BashTimeout: Duration(30 * time.Second),

View File

@@ -55,6 +55,7 @@ type Model struct {
input textarea.Model
mdRenderer *glamour.TermRenderer
expandOutput bool // ctrl+o toggles expanded tool output
cwd string
gitBranch string
scrollOffset int
@@ -199,6 +200,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.scrollOffset = 0
}
return m, nil
case "ctrl+o":
m.expandOutput = !m.expandOutput
return m, nil
case "pgup", "shift+up":
m.scrollOffset += 5
return m, nil
@@ -681,11 +685,14 @@ func (m Model) renderMessage(msg chatMessage) []string {
case "toolresult":
resultLines := strings.Split(msg.content, "\n")
maxShow := 10
if m.expandOutput {
maxShow = len(resultLines) // show all
}
for i, line := range resultLines {
if i >= maxShow {
remaining := len(resultLines) - maxShow
lines = append(lines, indent+indent+sHint.Render(
fmt.Sprintf("+%d lines (Ctrl+O to expand)", remaining)))
fmt.Sprintf("+%d lines (ctrl+o to expand)", remaining)))
break
}
// Diff coloring for edit results