Claus Ibsen created CAMEL-24372:
-----------------------------------
Summary: camel-tui - YAML editor: undo/redo, block-aware
move/duplicate/delete for EIP nodes
Key: CAMEL-24372
URL: https://issues.apache.org/jira/browse/CAMEL-24372
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
The TUI Source tab YAML editor currently supports basic character-level editing
(insert, delete, cursor movement, auto-indent, Tab completion, validate on
save). Several common editor operations are missing that would elevate it from
a basic text editor into a proper low-code tool for Camel routes.
The key insight is that operations like move, duplicate, and delete should be
*YAML-structure-aware* -- operating on entire EIP/node blocks rather than
single lines. In YAML DSL, a single EIP step is often multiple lines:
{code:yaml}
steps:
- setHeader:
name: foo
simple: "${body}"
- to:
uri: kafka:myTopic
parameters:
brokers: localhost:9092
- log:
message: "Done"
{code}
Moving one line at a time is not useful here. What users need is to move the
entire {{- setHeader:}} block (all 3 lines) as a unit, swapping it with the
adjacent sibling {{- to:}} block (all 4 lines). Block boundaries can be
detected from the {{- }} list item prefix and indentation level.
The editor already has the YAML DSL model from the catalog for Tab completion,
so it has structural awareness to know where blocks start and end.
*Proposed features (ranked by user value):*
# *Undo / Redo* (Ctrl+Z / Ctrl+Shift+Z) -- needs an undo stack in TextAreaState
or SourceViewer
# *Move EIP block up/down* (Alt+Up / Alt+Down) -- swap entire sibling blocks,
not single lines
# *Duplicate EIP block* (Ctrl+D) -- duplicate the whole block, useful for
adding similar steps
# *Delete EIP block* (Ctrl+Shift+K) -- delete the entire block at once
# *Word-level navigation* (Ctrl+Left / Ctrl+Right / Ctrl+Backspace) -- jump and
delete by word
# *Smart Home* -- first press goes to first non-whitespace, second press to
column 0
# *Find in edit mode* (Ctrl+F) -- search exists in view mode but not while
editing
# *Comment toggle* (Ctrl+/) -- add/remove # prefix on current line
--
This message was sent by Atlassian Jira
(v8.20.10#820010)