This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-23648-tui-send-fullscreen
in repository https://gitbox.apache.org/repos/asf/camel.git

commit db250d885475a071d7e08f2bfb123bef3f27a110
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun May 31 09:24:12 2026 +0200

    CAMEL-23648: camel-jbang - TUI add Reset Screen action to F2 menu
    
    Add a Reset Screen action to the F2 actions menu (Diagnostics group)
    that clears the terminal and resets TamboUI buffers, forcing a full
    redraw. Useful when the screen gets garbled from external interference.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../dsl/jbang/core/commands/tui/ActionsPopup.java  | 30 +++++++++++++++-------
 .../dsl/jbang/core/commands/tui/CamelMonitor.java  |  1 +
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ActionsPopup.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ActionsPopup.java
index cc8f3b4dfaf0..830bdfbccb6e 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ActionsPopup.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ActionsPopup.java
@@ -76,18 +76,19 @@ class ActionsPopup {
     private static final int ACTION_DOCTOR = 4;
     private static final int ACTION_CLASSPATH = 5;
     private static final int ACTION_RESET_STATS = 6;
-    private static final int ACTION_STOP_ALL = 7;
+    private static final int ACTION_RESET_SCREEN = 7;
+    private static final int ACTION_STOP_ALL = 8;
     // Group 3: Recording & Presentation
-    private static final int ACTION_SCREENSHOT = 8;
-    private static final int ACTION_TAPE_RECORDING = 9;
-    private static final int ACTION_TAPE_INSTRUCTIONS = 10;
-    private static final int ACTION_CAPTION = 11;
-    private static final int ACTION_SHOW_KEYSTROKES = 12;
+    private static final int ACTION_SCREENSHOT = 9;
+    private static final int ACTION_TAPE_RECORDING = 10;
+    private static final int ACTION_TAPE_INSTRUCTIONS = 11;
+    private static final int ACTION_CAPTION = 12;
+    private static final int ACTION_SHOW_KEYSTROKES = 13;
     // Group 4: MCP
-    private static final int ACTION_MCP_INFO = 13;
-    private static final int ACTION_MCP_LOG = 14;
+    private static final int ACTION_MCP_INFO = 14;
+    private static final int ACTION_MCP_LOG = 15;
 
-    private static final int[] GROUP_SIZES = { 4, 4, 5 };
+    private static final int[] GROUP_SIZES = { 4, 5, 5 };
     private static final int MCP_GROUP_SIZE = 2;
 
     private final Supplier<Set<String>> runningNames;
@@ -98,6 +99,7 @@ class ActionsPopup {
     private final Supplier<Boolean> keystrokesEnabled;
     private final Runnable toggleTapeRecording;
     private Runnable resetStatsAction;
+    private Runnable resetScreenAction;
     private final Supplier<Boolean> tapeRecordingActive;
     private MonitorContext ctx;
     private boolean mcpEnabled;
@@ -182,6 +184,10 @@ class ActionsPopup {
         this.resetStatsAction = resetStatsAction;
     }
 
+    void setResetScreenAction(Runnable resetScreenAction) {
+        this.resetScreenAction = resetScreenAction;
+    }
+
     void setMcpEnabled(
             boolean enabled, int port, Supplier<String> connectedClient, 
Supplier<List<TuiMcpServer.LogEntry>> activityLog) {
         this.mcpEnabled = enabled;
@@ -304,6 +310,7 @@ class ActionsPopup {
         labels.add("Run Doctor");
         labels.add("Show Classpath");
         labels.add("Reset Stats");
+        labels.add("Reset Screen");
         labels.add("Stop All");
         labels.add("───");
         // Group 3: Recording & Presentation
@@ -531,6 +538,11 @@ class ActionsPopup {
                         if (resetStatsAction != null) {
                             resetStatsAction.run();
                         }
+                    } else if (action == ACTION_RESET_SCREEN) {
+                        showActionsMenu = false;
+                        if (resetScreenAction != null) {
+                            resetScreenAction.run();
+                        }
                     } else if (action == ACTION_STOP_ALL) {
                         showActionsMenu = false;
                         stopAllPopup.open();
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
index 33dbb3c5faf6..200addfe5e0f 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java
@@ -357,6 +357,7 @@ public class CamelMonitor extends CamelCommand {
             this.runner = tui;
             ctx.runner = tui;
             actionsPopup.setScheduler(tui.scheduler());
+            actionsPopup.setResetScreenAction(() -> tui.terminal().clear());
             // Intercept Ctrl+C: quit the TUI cleanly instead of letting
             // the JVM tear down the classloader while we're still running
             Signal.handle(new Signal("INT"), sig -> tui.quit());

Reply via email to