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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 56c0fb6dbba5 CAMEL-23831: Add PgUp/PgDn and Home/End navigation to 
popups in camel-tui
56c0fb6dbba5 is described below

commit 56c0fb6dbba5d350f4351914d576d9dcf693a0de
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Jul 4 14:41:45 2026 +0200

    CAMEL-23831: Add PgUp/PgDn and Home/End navigation to popups in camel-tui
    
    CAMEL-23831: Add PgUp/PgDn section jump and Home/End to F2 actions menu in 
camel-tui
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../dsl/jbang/core/commands/tui/ActionsPopup.java  | 49 +++++++++++++++++++++-
 .../dsl/jbang/core/commands/tui/PopupManager.java  | 43 ++++++++++++++++++-
 2 files changed, 90 insertions(+), 2 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 aa3107e625a7..cd5073759a5b 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
@@ -331,6 +331,25 @@ class ActionsPopup {
         }
     }
 
+    private void navigateActionsMenuToSection(int direction) {
+        int total = visualActionCount();
+        Integer current = actionsMenuState.selected();
+        int pos = current != null ? current : 0;
+        // move until we hit a divider
+        pos += direction;
+        while (pos > 0 && pos < total - 1 && !isDividerIndex(pos)) {
+            pos += direction;
+        }
+        // skip past the divider to the first item in the section
+        if (isDividerIndex(pos)) {
+            pos += direction;
+        }
+        pos = Math.max(0, Math.min(pos, total - 1));
+        if (!isDividerIndex(pos)) {
+            actionsMenuState.select(pos);
+        }
+    }
+
     boolean isVisible() {
         return showActionsMenu || showGotoPopup || showExampleBrowser || 
showFolderInput || folderBrowser.isVisible()
                 || runOptionsForm.isVisible()
@@ -613,6 +632,7 @@ class ActionsPopup {
             return true;
         }
         if (showGotoPopup) {
+            int gotoSize = filteredTabEntries != null ? 
filteredTabEntries.size() : 0;
             if (ke.isCancel()) {
                 showGotoPopup = false;
                 gotoFilter.clearFilter();
@@ -620,7 +640,19 @@ class ActionsPopup {
             } else if (ke.isUp()) {
                 gotoListState.selectPrevious();
             } else if (ke.isDown()) {
-                gotoListState.selectNext(filteredTabEntries != null ? 
filteredTabEntries.size() : 0);
+                gotoListState.selectNext(gotoSize);
+            } else if (ke.isPageUp() || ke.isKey(KeyCode.PAGE_UP)) {
+                for (int i = 0; i < 5; i++) {
+                    gotoListState.selectPrevious();
+                }
+            } else if (ke.isPageDown() || ke.isKey(KeyCode.PAGE_DOWN)) {
+                for (int i = 0; i < 5; i++) {
+                    gotoListState.selectNext(gotoSize);
+                }
+            } else if (ke.isHome() || ke.isKey(KeyCode.HOME)) {
+                gotoListState.selectFirst();
+            } else if (ke.isEnd() || ke.isKey(KeyCode.END)) {
+                gotoListState.selectLast(gotoSize);
             } else if (ke.isConfirm()) {
                 Integer sel = gotoListState.selected();
                 if (sel != null && filteredTabEntries != null && sel < 
filteredTabEntries.size()) {
@@ -645,6 +677,21 @@ class ActionsPopup {
                 navigateActionsMenu(-1);
             } else if (ke.isDown()) {
                 navigateActionsMenu(1);
+            } else if (ke.isPageUp() || ke.isKey(KeyCode.PAGE_UP)) {
+                navigateActionsMenuToSection(-1);
+            } else if (ke.isPageDown() || ke.isKey(KeyCode.PAGE_DOWN)) {
+                navigateActionsMenuToSection(1);
+            } else if (ke.isHome() || ke.isKey(KeyCode.HOME)) {
+                actionsMenuState.select(0);
+                if (isDividerIndex(0)) {
+                    navigateActionsMenu(1);
+                }
+            } else if (ke.isEnd() || ke.isKey(KeyCode.END)) {
+                int last = visualActionCount() - 1;
+                actionsMenuState.select(last);
+                if (isDividerIndex(last)) {
+                    navigateActionsMenu(-1);
+                }
             } else if (ke.isConfirm()) {
                 Integer sel = actionsMenuState.selected();
                 if (sel != null) {
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/PopupManager.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/PopupManager.java
index acb5b5e55bc2..ad7880195c56 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/PopupManager.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/PopupManager.java
@@ -27,6 +27,7 @@ import dev.tamboui.text.CharWidth;
 import dev.tamboui.text.Line;
 import dev.tamboui.text.Span;
 import dev.tamboui.text.Text;
+import dev.tamboui.tui.event.KeyCode;
 import dev.tamboui.tui.event.KeyEvent;
 import dev.tamboui.tui.event.MouseEvent;
 import dev.tamboui.tui.event.MouseEventKind;
@@ -183,7 +184,27 @@ class PopupManager {
             return true;
         }
         if (ke.isDown()) {
-            morePopupState.selectNext(18);
+            morePopupState.selectNext(MORE_POPUP_ITEM_COUNT);
+            return true;
+        }
+        if (ke.isPageUp() || ke.isKey(KeyCode.PAGE_UP)) {
+            for (int i = 0; i < 5; i++) {
+                morePopupState.selectPrevious();
+            }
+            return true;
+        }
+        if (ke.isPageDown() || ke.isKey(KeyCode.PAGE_DOWN)) {
+            for (int i = 0; i < 5; i++) {
+                morePopupState.selectNext(MORE_POPUP_ITEM_COUNT);
+            }
+            return true;
+        }
+        if (ke.isHome() || ke.isKey(KeyCode.HOME)) {
+            morePopupState.selectFirst();
+            return true;
+        }
+        if (ke.isEnd() || ke.isKey(KeyCode.END)) {
+            morePopupState.selectLast(MORE_POPUP_ITEM_COUNT);
             return true;
         }
         int shortcutSel = morePopupShortcut(ke);
@@ -215,6 +236,26 @@ class PopupManager {
             switchPopupState.selectNext(switchList.size());
             return true;
         }
+        if (ke.isPageUp() || ke.isKey(KeyCode.PAGE_UP)) {
+            for (int i = 0; i < 5; i++) {
+                switchPopupState.selectPrevious();
+            }
+            return true;
+        }
+        if (ke.isPageDown() || ke.isKey(KeyCode.PAGE_DOWN)) {
+            for (int i = 0; i < 5; i++) {
+                switchPopupState.selectNext(switchList.size());
+            }
+            return true;
+        }
+        if (ke.isHome() || ke.isKey(KeyCode.HOME)) {
+            switchPopupState.selectFirst();
+            return true;
+        }
+        if (ke.isEnd() || ke.isKey(KeyCode.END)) {
+            switchPopupState.selectLast(switchList.size());
+            return true;
+        }
         if (ke.isConfirm()) {
             showSwitchPopup = false;
             Integer sel = switchPopupState.selected();

Reply via email to