davsclaus opened a new pull request, #29724:
URL: https://github.com/apache/camel/pull/29724

   The follow-ups of the TamboUI 0.7.0 upgrade (CAMEL-26854, #29631) for the 
`camel tui` plugin, in one PR with one commit per JIRA.
   
   ## [CAMEL-26858](https://issues.apache.org/jira/browse/CAMEL-26858): Kitty 
keyboard protocol
   
   - `TuiBackendHelper` asks for `KeyboardProtocol.AUTO` instead of `LEGACY`. A 
terminal that supports the protocol (Kitty, Ghostty, WezTerm, foot, iTerm2) 
then reports keys with their modifiers. A terminal without it ignores the 
request and sends the legacy keys. The local terminal and the `--web` session 
both use this helper.
   - AI prompt: **Shift+Enter** and **Alt+Enter** start a new line, and 
**Ctrl+N** still works in every terminal (`AiPanel.isLineBreakKey`). Before 
this, Alt+Enter sent the question.
   - Embedded shell (F6): `ShellPanel.encodeKeyEvent` passes modifiers on the 
way xterm does:
     - Alt is an Esc prefix, so readline's Alt+B, Alt+F and Alt+Backspace work.
     - The arrows, Home/End, PgUp/PgDn, Delete and the F-keys get the modifier 
parameter (`ESC [1;5D` for Ctrl+Left).
     - Shift+Tab is `ESC [Z`.
     - Since 0.7.0 these keys arrive with their modifiers in legacy mode too, 
and they used to reach the shell without them.
   - Key binding review:
     - Nothing in the plugin depends on a legacy encoding: no Ctrl+H, I, M or J 
bindings, and the Ctrl+letter shortcuts arrive as `CHAR` with `CTRL` in both 
modes.
     - AUTO does not turn on release events, so a handler does not run twice.
   
   ## [CAMEL-26859](https://issues.apache.org/jira/browse/CAMEL-26859): 
TextEditing and word-wise editing
   
   - `FormHelper.handleTextInput` and `handleTextArea` hand the key to 
TamboUI's `TextEditing`.
   - `FormHelper.typedText` follows `KeyEvent.isTyping()`, so keypad digits 
type as well.
   - `SettingsPopup`, `RunOptionsForm` (digits-only fields via `TextEditing`'s 
`allowed` filter), `InfraBrowserPopup`, `SqlQueryTab` and the body fields of 
the HTTP probe and Send Message forms drop their own copies of the editing code.
   - Word-wise keys from TamboUI's bindings:
     - Ctrl+Left/Right moves a word, Ctrl+Backspace / Ctrl+W deletes the word 
before the cursor, and Ctrl+Delete the word after it.
     - On macOS the bindings use Alt instead of Ctrl.
   - The inputs that handle some keys themselves get the word keys too: the AI 
prompt, the type-to-filter popups (`FuzzyFilter.deleteWord`), the source editor 
(the word delete records an undo step), and the key/value rows of the probe and 
Send Message forms.
   - Before this, Alt+Backspace in a filter deleted one character. On macOS it 
now deletes a word.
   
   ## [CAMEL-26860](https://issues.apache.org/jira/browse/CAMEL-26860): 
Constraint.fit()
   
   - The SQL query result grid sizes its columns with `Constraint.fit()`:
     - The width comes from TamboUI's `CharWidth`, where it was 
`String.length()` with a fixed cap per column.
     - Wide characters line up now.
     - When the grid is too wide, the narrow columns keep their width.
   - The other tables stay as they are, because `fit()` cannot express what 
they need:
     - Some columns are capped.
     - Some widths come from the screen width.
     - Some widths feed the budget of another column.
     - Some content changes every second, and `fit()` would make those columns 
jitter.
   
   ## [CAMEL-26861](https://issues.apache.org/jira/browse/CAMEL-26861): Mouse 
commands in recorded tapes
   
   - Playback supports TamboUI 0.7.0's tape syntax:
     - `Click`, `RightClick` and `MiddleClick` at a cell
     - `MouseDown`, `MouseUp` and `MouseMove`
     - `Drag[@delay] x1 y1 x2 y2`
     - `ScrollUp`, `ScrollDown`, `ScrollLeft` and `ScrollRight`, with an 
optional count and cell
   - Recording:
     - Clicks and drags are recorded, and quick wheel turns are merged into one 
line with a count.
     - Moves with no button held are not recorded.
     - A click on a footer key hint is recorded as the key it presses.
     - The tape notes the screen size its positions belong to.
   - Docs: "Mouse commands" in the recording page.
   
   ## [CAMEL-26862](https://issues.apache.org/jira/browse/CAMEL-26862): 
Workarounds
   
   - Removed:
     - `AiPanel.quoteQuestion` used to take a code block out of the quoted 
question. TamboUI 0.7.0 renders a code block inside a quote (tamboui#503), so 
it now stays in the quote.
     - The example browser kept a list of row heights next to its items. Now 
the heights come from `ListItem.height()` (tamboui#509).
   - Kept:
     - `clampTableOffset`: the fix (tamboui#507) is not in 0.7.0.
     - `fitLine`/`truncate`: they already use TamboUI's 
`CharWidth.truncateWithEllipsis`. `Overflow.ELLIPSIS` would flatten span styles 
and change the width of block titles.
     - `ansiToLine`, the syntax highlighter overlay and `wrappedRows`: their 
fixes are not released yet.
   
   ## Docs
   
   - `camel-jbang-tui.adoc`: a new "Text Fields" section lists the editing keys 
and explains the Kitty keyboard protocol.
   - The AI prompt page, the F1 help, the source editor shortcuts and the 
recording page are updated.
   
   ## Testing
   
   - The full `camel-jbang-plugin-tui` test suite passes. New tests:
     - word keys in `FormHelper`, `AiInputLine`, 
`FilterListPopup`/`FuzzyFilter` and `SourceEditorNavigation`
     - `AiPanel.isLineBreakKey` and the shell key encoding with modifiers
     - the AUTO protocol in `TuiBackendHelperRecordingTest`
     - `SqlQueryResultTableTest`, `ExampleBrowserPopupTest`, 
`TapeRecorderMouseTest`, and more cases in `TapePlayerTest`
   - Live check of the Kitty protocol: the branch TUI ran in a pseudo-terminal, 
Kitty-encoded keys were written into it, and the screen was read back over MCP.
     - On start the TUI sends the push sequence (`CSI >5u`), and on exit the 
pop sequence (`CSI <u`).
     - Shift+F2 opens Go to. In its filter, Ctrl+W (`CSI 119;5u`) deletes a 
word, and Esc (`CSI 27u`) closes the popup.
     - In the AI prompt, Shift+Enter (`CSI 13;2u`) and Alt+Enter (`CSI 13;3u`) 
break the line, and Enter sends the question with its line breaks.
     - Ctrl+C (`CSI 99;5u`) quits.
   - Not done yet: a manual run in a real Kitty-protocol terminal (iTerm2, 
Kitty, Ghostty).
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to