Commit graph

11 commits

Author SHA1 Message Date
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
Mario Zechner
178a3a563f fix(tui): handle split Shift+Enter in VS Code 2026-01-11 04:03:42 +01:00
Nick Seelert
dde5f25170 feat(tui): implement word wrapping in Editor component
Previously, the Editor component used character-level (grapheme-level)
wrapping, which broke words mid-character at line boundaries. This
created an ugly visual experience when typing or pasting long text.

Now the Editor uses word-aware wrapping:
- Wraps at word boundaries when possible
- Falls back to character-level wrapping for tokens wider than the
  available width (e.g., long URLs)
- Strips leading whitespace at line starts
- Preserves multiple spaces within lines

Added wordWrapLine() helper function that tokenizes text into words
and whitespace runs, then builds chunks that fit within the specified
width while respecting word boundaries.

Also updated buildVisualLineMap() to use the same word wrapping logic
for consistent cursor navigation.

Added tests for:
- Word boundary wrapping
- Leading whitespace stripping
- Long token (URL) character-level fallback
- Multiple space preservation
- Edge cases (empty string, exact fit)
2025-12-30 23:05:35 -05:00
Ahmed Kamal
0427445242
Fix Ctrl+W to use standard readline word deletion behavior (#306)
- Skip trailing whitespace before deleting word (readline behavior)
- Make word navigation grapheme-aware using Intl.Segmenter
- Add Ctrl+Left/Right and Alt+Left/Right word navigation to Input
- Accept full Unicode input while rejecting control characters (C0/C1/DEL)
- Extract shared utilities to utils.ts (getSegmenter, isWhitespaceChar, isPunctuationChar)
- Fix unsafe cast in Editor.forceFileAutocomplete with runtime type check
- Add comprehensive tests for word deletion and navigation
2025-12-25 04:09:47 +01:00
Mario Zechner
65c292b7dd Fix outdated editor tests for grapheme-aware cursor movement 2025-12-19 21:41:28 +01:00
Markus Ylisiurunen
4b04c87b3d
add new getCursor and getLines methods to editor (#201) 2025-12-16 20:13:43 +01:00
Mario Zechner
d7f84469a7 Fix editor crash with wide characters (emojis, CJK)
Editor text wrapping now uses grapheme-aware width calculation instead
of string length. Fixes crash when pasting text containing emojis like
 or CJK characters that are 2 terminal columns wide.
2025-12-06 21:24:26 +01:00
Nico Bailon
c550ed2bca feat(tui): add prompt history navigation with Up/Down arrows
Browse previously submitted prompts using Up/Down arrow keys, similar to
shell history and Claude Code's prompt history feature.

- Up arrow when editor is empty: browse to older prompts
- Down arrow when browsing: return to newer prompts or clear editor
- Cursor movement within multi-line history entries supported
- History is session-scoped, stores up to 100 entries
- Consecutive duplicates are not added to history

Includes 15 new tests for history navigation behavior.
2025-12-05 07:57:42 -08:00
Mario Zechner
85adcf22bf Release v0.8.0 2025-11-21 03:12:42 +01:00
Mario Rodler
b37d601317 test(editor): Simplify and refine Unicode handling tests for clarity and consistency 2025-11-16 21:05:49 +01:00
Mario Rodler
ce0c42f539 test(editor): Add tests for handling extended characters, emojis, and special key inputs 2025-11-16 18:15:21 +01:00