Commit graph

505 commits

Author SHA1 Message Date
aos
225fcb3830
feat: make session selector keybindings configurable (#948)
I lost my ability to select up and down in the session selector because
of some hardcoded keybindings again... So, I am adding these
configurable keybindings so I can `ctrl+p` to select up :-)

### Changes

Adds 4 new keybinding actions for the session picker (/resume):
- `toggleSessionPath` (ctrl+p) - toggle path display
- `toggleSessionSort` (ctrl+r) - toggle sort mode
- `deleteSession` (ctrl+d) - delete selected session
- `deleteSessionNoninvasive` (ctrl+backspace) - delete when query empty

Refactors session-selector to use `kb.matches()` instead of hardcoded key checks.
2026-01-25 20:08:11 +01:00
Sviatoslav Abakumov
beb1455cab
fix(tui): move lastAction handling out of setTextInternal()
The caller is responsible for doing that.
2026-01-25 17:50:55 +04:00
Sviatoslav Abakumov
609095b0b6
fix(tui): refactor the multi-line insertion handling 2026-01-25 17:50:50 +04:00
Sviatoslav Abakumov
7d2d170c1b
fix(tui): handle multi-line text in insertTextAtCursor()
Add insertTextAtCursorInternal() to properly handle newlines by splitting
lines at the cursor position.

- Normalize line endings (CRLF/CR to LF)
- Handle single-line and multi-line insertion
- Position cursor at end of inserted text
- Call onChange only once at the end

Refactor handlePaste() to use insertTextAtCursorInternal() for
multi-line pastes, while retaining character-by-character insertion for
single-line pastes to preserve autocomplete triggering.
2026-01-25 17:28:54 +04:00
Mario Zechner
79ded84d46
Merge pull request #936 from Perlence/fix/extension-editor-padding-x
fix(coding-agent): propagate paddingX to custom editors
2026-01-24 20:48:41 +01:00
Sviatoslav Abakumov
2bbc255237
fix(coding-agent): propagate paddingX to custom editors
setCustomEditorComponent() was not copying the paddingX setting from
the default editor to extension-provided editors. Also propagate live
changes from the settings callback.
2026-01-24 21:00:14 +04:00
Sviatoslav Abakumov
b5ab90f837
fix(tui): reserve 1 column for cursor in word wrap width 2026-01-24 17:41:10 +04:00
Sviatoslav Abakumov
9090268b7d
fix(tui): rewrite word wrap as single-pass with backtracking 2026-01-23 22:31:41 +04:00
Mario Zechner
f42deae13e fix(tui): gate slash menu to empty input 2026-01-22 23:12:33 +01:00
Mario Zechner
fbd6b7f9ba fix(tui): prevent image ID collisions between modules
- allocateImageId() now returns random IDs instead of sequential
- Static images no longer auto-allocate IDs (transient display)
- Only explicit imageId usage (like DOSBox) gets tracked IDs
- Suppress emulators exit logging in DOSBox dispose

Fixes image replacement bug when extension and main app both
allocated sequential IDs starting at 1.
2026-01-22 04:52:55 +01:00
Mario Zechner
df1d5c40ea fix(tui): proper Kitty image ID management and cleanup
- Add allocateImageId() to generate unique image IDs
- Add deleteKittyImage() and deleteAllKittyImages() functions
- Image component now tracks its ID and has dispose() method
- renderImage() returns imageId for tracking
- DOSBox: reuse single image ID for all frames, delete on dispose

Fixes image accumulation hitting terminal quota and lingering
images after component close.
2026-01-22 04:39:58 +01:00
Mario Zechner
df8b3544c3 Add [Unreleased] section for next cycle 2026-01-22 01:43:26 +01:00
Mario Zechner
34d28a47b5 Release v0.49.3 2026-01-22 01:42:43 +01:00
Mario Zechner
b7cef51f3f fix(tui): don't add space after directory completion for @ file attachments 2026-01-21 23:48:41 +01:00
Mario Zechner
4ed9527213 docs: add missing changelog entries for commits since v0.49.2 2026-01-21 23:32:28 +01:00
Richard Gill
7dc652f304
Autocomplete allow searchs with /'s like: folder1/folder2 (#882)
* Extend fd autocomplete tests

* Renamed fixture type in autocomplete test
2026-01-21 23:23:51 +01:00
Michael Renner
620239bd3f
fix(tui): prevent duplicate URL display for autolinked emails (#888)
Autolinked emails like user@example.com were rendered as
'user@example.com (mailto:user@example.com)' because the comparison
token.text === token.href failed (text lacks mailto: prefix).

Now strips mailto: prefix before comparing, so autolinked emails
display without redundant URL in parentheses.
2026-01-21 23:20:00 +01:00
Mario Zechner
565488fde6 fix(tui): fix viewport tracking and cursor positioning for overlays and content shrink
- Add maxLinesRendered to track terminal's working area (grows with content, only resets on full clear)
- Fix viewport calculation: use maxLinesRendered instead of cursorRow for correct viewport bounds
- Separate cursorRow (end of content for viewport calc) from hardwareCursorRow (actual cursor position)
- Refactor full render into fullRender(clear) helper to reduce duplication
- Fix shrink-clearing: properly clear extra lines when content shrinks
- Add PI_TUI_DEBUG=1 env var for render debugging (writes to /tmp/tui/)

The core issue was that after partial renders (e.g., overlay show/hide), the viewport
calculation used cursorRow which reflected where rendering stopped, not where content
ended. This caused incorrect viewport bounds, leading to cursor movement into scrollback
(unreachable) or rendering at wrong positions.

Additionally, when content shrank (e.g., selector dismissed), the terminal still had
the old lines as blank space. maxLinesRendered tracks this so viewport calculations
account for the terminal's actual working area.
2026-01-20 23:30:53 +01:00
Sviatoslav Abakumov
698aea34bd
feat(tui): add Alt+Delete as hotkey for Delete word forwards (#878)
* feat(tui): add Alt+Delete as hotkey for delete word forwards

* docs(coding-agent): update keybindings table with Alt+Delete
2026-01-20 23:03:44 +01:00
Michael Renner
20c7b5fed4
feat(tui, coding-agent): add configurable code block indent setting (#855)
Add markdown.codeBlockIndent setting to customize indentation prefix for
rendered code blocks. Default remains 2 spaces for visual clarity, but
setting to empty string removes indentation for easier copy/paste of
code snippets to scripts, editors, or other tools.

Changes:
- tui: add optional codeBlockIndent to MarkdownTheme interface
- coding-agent: add MarkdownSettings with codeBlockIndent property
- coding-agent: compose theme with settings at call sites (no global state)
- coding-agent: update message components to accept optional MarkdownTheme

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-01-19 22:36:03 +01:00
Armin Ronacher
d37b5a52d7
More fuzzy finder (#860) 2026-01-19 22:22:51 +01:00
Mario Zechner
2f4b510c12 Add [Unreleased] section for next cycle 2026-01-19 16:14:47 +01:00
Mario Zechner
17a37bd174 Release v0.49.2 2026-01-19 16:14:07 +01:00
Mario Zechner
0e5977ad39 Add [Unreleased] section for next cycle 2026-01-19 00:23:57 +01:00
Mario Zechner
15a04c585a Release v0.49.1 2026-01-19 00:23:11 +01:00
Mario Zechner
037cc9c3f0 docs: add changelog entries for undo feature 2026-01-19 00:19:00 +01:00
Sviatoslav Abakumov
fb1242829d feat(tui): add legacy terminal support for Ctrl+symbol keys
Ctrl+\ sends ASCII 28 (File Separator) in legacy terminals. This is
commonly used as SIGQUIT in Unix.

Ctrl+] sends ASCII 29 (Group Separator) in legacy terminals. This is
commonly used as the telnet escape character.

Ctrl+_ sends ASCII 31 (Unit Separator) in legacy terminals. On US
keyboards, - and _ are on the same physical key, so this also functions
as an alias for Ctrl+-.
2026-01-19 00:18:47 +01:00
Sviatoslav Abakumov
6bde679a5f fix(tui): use the non-null assertion operator instead of assert() 2026-01-19 00:18:47 +01:00
Sviatoslav Abakumov
bacf334bc4 feat(tui): add undo support to Editor with the Ctrl+- hotkey
Undo snapshots are captured for all edit operations:

- Word insertion, backspace, forward delete
- Word/line deletion (Ctrl+W, Ctrl+U, Ctrl+K, Alt+D)
- Yank/yank-pop, paste, autocomplete completion
- Cursor movement starts a new undo unit
- setText() pushes snapshot when content changes

Additionally, history browsing captures the undo state on first entry.
2026-01-19 00:18:47 +01:00
Mario Zechner
ad337e30be docs: document Focusable interface propagation pattern for IME support
Container components with embedded Input/Editor children must implement
Focusable and propagate focus state to enable correct IME candidate
window positioning.

Related to #827
2026-01-18 17:27:16 +01:00
Mario Zechner
632495338f Add [Unreleased] section for next cycle 2026-01-17 22:02:59 +01:00
Mario Zechner
3e6ae39083 Release v0.49.0 2026-01-17 22:02:12 +01:00
Mario Zechner
18d9d9d704 fix(tui): document kill ring and reset history 2026-01-17 21:12:48 +01:00
Sviatoslav Abakumov
505894f4ea feat(tui): add Alt+D to delete word forward (kill)
Adds deleteWordForward action bound to Alt+D, which deletes from cursor
to the end of the current word and saves to kill ring for later yanking.
Consecutive forward kills append to the same kill ring entry.
2026-01-17 21:11:20 +01:00
Sviatoslav Abakumov
9fb7434a06 feat(tui): implement Emacs-style kill ring for Editor
Add kill ring functionality with:

- Ctrl+W/U/K save deleted text to kill ring
- Ctrl+Y yanks (pastes) most recent deletion
- Alt+Y cycles through kill ring (after Ctrl+Y)
- Consecutive deletions accumulate into single entry
2026-01-17 21:11:20 +01:00
Sviatoslav Abakumov
bafddc27ed feat(tui): add legacy Alt+letter key sequence support
In legacy terminal mode (non-Kitty protocol), Alt+key is sent as ESC
followed by the key character. This was only supported for specific keys
(space, backspace, arrows) but not for regular letters.

Add support for Alt+letter sequences to enable keybindings like Alt+Y.
2026-01-17 21:11:20 +01:00
Mario Zechner
673916f63c fix(tui): always position cursor for IME
# Conflicts:
#	packages/coding-agent/CHANGELOG.md
2026-01-17 11:40:39 +01:00
Mario Zechner
7f9cf543d5 Add [Unreleased] section for next cycle 2026-01-17 00:32:57 +01:00
Mario Zechner
91be338e39 Release v0.48.0 2026-01-17 00:32:07 +01:00
Mario Zechner
5c938e08d0 docs: document EditorOptions paddingX and editorPaddingX setting 2026-01-16 23:57:35 +01:00
Mario Zechner
fe52ff00d2 feat: add editorPaddingX setting for input editor horizontal padding 2026-01-16 23:50:00 +01:00
ferologics
48ea444bc4 fix: align input editor with message content padding
Adds paddingX option to Editor component and hardcodes paddingX: 1 in
coding-agent editors so the cursor/text aligns with chat message content.
2026-01-16 23:15:06 +01:00
Mario Zechner
0c33e0dee5 chore: audit changelog entries for v0.47.0, add cl.md prompt template
- Add missing changelog entries for commits since v0.47.0
- Cross-duplicate ai/tui fixes to coding-agent changelog
- Change PI_NO_HARDWARE_CURSOR to PI_HARDWARE_CURSOR (opt-in)
- Fix typo in PI_CODING_AGENT_DIR changelog entry
- Add .pi/prompts/cl.md for pre-release changelog audits
2026-01-16 21:11:01 +01:00
Sarat Chandra
12ab69fbad
fix(tui): decode Kitty CSI-u shifted symbols (#779) 2026-01-16 17:53:15 +01:00
Mario Zechner
4dbf094b65 Add PI_NO_HARDWARE_CURSOR env var for terminals with limited escape sequence support
Fixes cursor visibility issues in JetBrains IDE terminals (IntelliJ, PyCharm) where
the hardware cursor either blinks or becomes invisible depending on settings.

Fixes #771
2026-01-16 12:51:09 +01:00
Mario Zechner
589a2ffcd3 Add [Unreleased] section for next cycle 2026-01-16 04:41:48 +01:00
Mario Zechner
6248d86ff6 Release v0.47.0 2026-01-16 04:41:04 +01:00
Mario Zechner
cb369b680b Update changelogs for v0.47.0 release
- Add OpenAI Codex official support entry
- Add pi-internal:// URL scheme
- Add ctx.shutdown() fix (#756)
- Add OpenAI Codex retry logic (#733)
- Add third-party contributions:
  - #702 by @aliou (custom tool HTML export)
  - #728 by @richardgill (frontmatter parsing, SelectList fix)
  - #747 by @kaofelix (tree filter shortcuts)
  - #752 by @richardgill (keymap expansion)
2026-01-16 04:39:48 +01:00
Mario Zechner
07fad1362c feat(tui): hardware cursor positioning for IME support
- Add Focusable interface for components that need hardware cursor positioning
- Add CURSOR_MARKER (APC escape sequence) for marking cursor position in render output
- Editor and Input components implement Focusable and emit marker when focused
- TUI extracts cursor position from rendered output and positions hardware cursor
- Track hardwareCursorRow separately from cursorRow for differential rendering
- visibleWidth() and extractAnsiCode() now handle APC sequences
- Update overlay-test.ts example to demonstrate Focusable usage
- Add documentation for Focusable interface in docs/tui.md

Closes #719, closes #525
2026-01-16 04:30:07 +01:00
Mario Zechner
356a482527 fix(tui): add vertical scrolling to Editor when content exceeds terminal height
The Editor component now accepts TUI as the first constructor parameter,
enabling it to query terminal dimensions. When content exceeds available
height, the editor scrolls vertically keeping the cursor visible.

Features:
- Max editor height is 30% of terminal rows (minimum 5 lines)
- Page Up/Down keys scroll by page size
- Scroll indicators show lines above/below: ─── ↑ 5 more ───

Breaking change: Editor constructor signature changed from
  new Editor(theme)
to
  new Editor(tui, theme)

fixes #732
2026-01-16 04:12:21 +01:00