Commit graph

16 commits

Author SHA1 Message Date
dullfig
4dcc726280 Fix command history with history_backward/forward methods
auto_up/auto_down were wrong - use history_backward/history_forward
for proper command history navigation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:23:41 -08:00
dullfig
8e98e98bf1 Add command history (Up/Down) and spacer above separator
- Up/Down arrows now navigate command history via auto_up/auto_down
- Added blank line spacer between output and separator for clarity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:21:07 -08:00
dullfig
35b3381b7c Simplify scroll: Page Up/Down always, Up/Down for history
Standard CLI behavior:
- Up/Down = command history (always)
- Page Up/Down = scroll output (no focus needed)
- Ctrl+Home/End = jump to top/bottom
- Mouse/scrollbar works too

Removed Tab focus switching - not intuitive for CLI users.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:15:53 -08:00
dullfig
ed02281513 Fix filter lambda causing TUI to fail
Use Condition wrapper with try/except to handle case where
self.app doesn't exist yet during key binding setup.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:12:44 -08:00
dullfig
10daf0ce70 Add arrow key scrolling for output when focused
- Up/Down move cursor one line (scrolls view)
- Page Up/Down move 20 lines at a time
- Home/End jump to top/bottom
- Keys only active when output buffer is focused (Tab to switch)
- Updated help text with scroll shortcuts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:11:07 -08:00
dullfig
fbb6c28ab7 Rewrite output to use Buffer for native scrolling
FormattedTextControl doesn't support scrolling - always renders from top.
Switch to Buffer + BufferControl which has proper scroll support:
- Output buffer uses read-only Buffer with cursor at end
- Tab/Shift-Tab to switch focus between output and input
- Arrow keys scroll when output is focused
- Scrollbar margin shows position
- Auto-scroll on new content (cursor stays at end)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:07:07 -08:00
dullfig
f58197c83f Fix scroll with custom scroll_offset mechanism
Window.vertical_scroll is read-only in prompt_toolkit.
Use custom scroll_offset to track position and slice output lines.
- scroll_offset=0 shows newest content (auto-scroll)
- Page Up increases offset (scroll into history)
- Page Down decreases offset (towards newest)
- Home/End jump to top/bottom

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:04:04 -08:00
dullfig
92e663d6a2 Add scrollable output history to TUI console
- Add Page Up/Down, Home/End key bindings for manual scrolling
- Track user_scrolled flag to preserve position when user scrolls
- Remove visible_lines limit to show full history
- Auto-scroll to bottom on new content (unless user scrolled up)
- Update help text with scroll shortcuts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:00:36 -08:00
dullfig
e254ac7bf6 Force output window to scroll to bottom
- Set vertical_scroll=999999 to always show newest content
- Update scroll position on every invalidate
- Reduced visible_lines to 20 for safety

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:55:12 -08:00
dullfig
ce37278dcd Fix output area to show content at bottom
- Use HSplit with filler + output to push content to bottom
- Output window uses dont_extend_height so it only takes needed space
- Empty filler expands to fill remaining space above

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:52:33 -08:00
dullfig
d59dd4968d Fix output scrolling - show only last 50 lines
Instead of trying to scroll the window, just display the most
recent lines that fit on screen. Full history is kept but only
the last 50 lines are rendered.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:50:07 -08:00
dullfig
3e5803d41b Fix FormattedText newline handling 2026-01-11 14:39:21 -08:00
dullfig
5a76797613 Add refresh loop for reliable TUI output updates
- Remove patch_stdout (was buffering until exit)
- Add 100ms refresh loop that periodically invalidates the app
- Ensures output buffer changes are displayed in real-time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:37:02 -08:00
dullfig
cc5257d342 Fix TUI output with patch_stdout
- Add patch_stdout to capture external prints in TUI mode
- Any stdout from handlers/pump appears in output area, not prompt
- Simplify response handler logic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:34:03 -08:00
dullfig
ad507cd54a Fix TUI console response display
- Add thread-safe invalidation for cross-task updates
- Fix response handler to properly route to TUI output
- Add debug output if console hook fails

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:30:36 -08:00
dullfig
6a5c047d1e Add split-screen TUI console with prompt_toolkit
New console features:
- Scrolling output area above separator line
- Status bar with organism name
- Input area at bottom
- Color-coded messages by source
- Command history with up/down arrows
- Graceful fallback to simple mode on unsupported terminals

Usage:
  python run_organism.py           # TUI mode (or fallback)
  python run_organism.py --simple  # Force simple mode

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:23:19 -08:00