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 59c12bf0daa6 chore: Use arrow keys for tab switching in SourceViewer
overlays
59c12bf0daa6 is described below
commit 59c12bf0daa6dbd635564fc73b9044f6b64ba401
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Jul 23 13:03:08 2026 +0200
chore: Use arrow keys for tab switching in SourceViewer overlays
Replace single-letter key bindings (M/R for Markdown/Raw, Y/J/X for
YAML/Java/XML) with Tab and arrow keys for consistent tab switching,
matching the pattern used in OptionsViewerPopup. Prevent Tab/Shift-Tab
from switching the top-level tab bar when a SourceViewer overlay is
active. Fix bogus F1 help text about rate unit toggle.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../dsl/jbang/core/commands/tui/CamelMonitor.java | 6 ++-
.../dsl/jbang/core/commands/tui/MonitorTab.java | 4 ++
.../dsl/jbang/core/commands/tui/OverviewTab.java | 2 +-
.../dsl/jbang/core/commands/tui/RoutesTab.java | 5 +++
.../dsl/jbang/core/commands/tui/SourceViewer.java | 48 ++++++++++------------
5 files changed, 35 insertions(+), 30 deletions(-)
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 7d8ee4726e57..57bd47762717 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
@@ -749,7 +749,9 @@ public class CamelMonitor extends CamelCommand {
}
}
}
- if (ke.isFocusPrevious() && !textEditing) {
+ MonitorTab activeMonitorTab = tabRegistry.activeTab();
+ boolean overlayActive = activeMonitorTab != null &&
activeMonitorTab.isOverlayActive();
+ if (ke.isFocusPrevious() && !textEditing && !overlayActive) {
if (isInfraSelected()) {
int prev = tabRegistry.selectedTabIndex() == TAB_OVERVIEW ?
TAB_LOG : TAB_OVERVIEW;
tabsState.select(prev);
@@ -759,7 +761,7 @@ public class CamelMonitor extends CamelCommand {
}
return true;
}
- if (ke.isFocusNext() && !textEditing) {
+ if (ke.isFocusNext() && !textEditing && !overlayActive) {
if (isInfraSelected()) {
int next = tabRegistry.selectedTabIndex() == TAB_OVERVIEW ?
TAB_LOG : TAB_OVERVIEW;
tabsState.select(next);
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorTab.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorTab.java
index b7ef0143d3bc..506767cc5d6a 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorTab.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MonitorTab.java
@@ -85,4 +85,8 @@ interface MonitorTab {
default boolean setInputValue(String field, String value) {
return false;
}
+
+ default boolean isOverlayActive() {
+ return false;
+ }
}
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java
index 49fcca59bd53..c59b79374d85 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/OverviewTab.java
@@ -1252,7 +1252,7 @@ class OverviewTab extends AbstractTab {
- **VERSION** — Camel version the integration is running on
(e.g., `4.21.0`)
- **STATUS** — Current lifecycle state: `Running` (processing
messages), `Started` (ready), or `Stopped`
- **AGE** — How long the integration has been running (e.g.,
`2m30s`, `1h15m`)
- - **MSG/S** or **MSG/M** — Messages processed per second or
per minute (current throughput). Toggle with `u`. This is the overall rate
across all routes
+ - **MSG/S** or **MSG/M** — Messages processed per second or
per minute (current throughput). The rate unit can be configured in settings.
This is the overall rate across all routes
- **TOTAL** — Total number of exchanges (messages) processed
since the integration started
- **FAIL** — Number of exchanges that ended with an unhandled
error
- **INFLIGHT** — Exchanges currently being processed right
now. A consistently high inflight count may indicate slow downstream services
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
index 41122c516075..a5d6a73c9c9a 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RoutesTab.java
@@ -102,6 +102,11 @@ class RoutesTab extends AbstractTab {
return sourceViewer.isVisible();
}
+ @Override
+ public boolean isOverlayActive() {
+ return sourceViewer.isVisible();
+ }
+
@Override
public boolean handleKeyEvent(KeyEvent ke) {
// Source view scrolling (takes priority when active)
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java
index 020b02a75dd5..505b3dc39a5f 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java
@@ -156,15 +156,9 @@ class SourceViewer {
onLineSelected = null;
return true;
}
- if (isMarkdownFile) {
- if (ke.isChar('M') || ke.isChar('m')) {
- markdownMode = true;
- return true;
- }
- if (ke.isChar('R') || ke.isChar('r')) {
- markdownMode = false;
- return true;
- }
+ if (isMarkdownFile && (ke.isKey(KeyCode.TAB) || ke.isLeft() ||
ke.isRight())) {
+ markdownMode = !markdownMode;
+ return true;
}
if (markdownMode) {
if (ke.isUp() || ke.isChar('k')) {
@@ -182,19 +176,23 @@ class SourceViewer {
}
return true;
}
- if (currentRouteId != null) {
- if (ke.isChar('Y') || ke.isChar('y')) {
- switchFormat("yaml");
- return true;
- }
- if (ke.isChar('J') || ke.isChar('j')) {
- switchFormat("java");
- return true;
+ if (currentRouteId != null
+ && (ke.isKey(KeyCode.TAB) || ke.isRight() || ke.isLeft())) {
+ String[] formats = { "yaml", "java", "xml" };
+ int idx = 0;
+ for (int i = 0; i < formats.length; i++) {
+ if (formats[i].equals(currentFormat)) {
+ idx = i;
+ break;
+ }
}
- if (ke.isChar('X') || ke.isChar('x')) {
- switchFormat("xml");
- return true;
+ if (ke.isLeft()) {
+ idx = (idx - 1 + formats.length) % formats.length;
+ } else {
+ idx = (idx + 1) % formats.length;
}
+ switchFormat(formats[idx]);
+ return true;
}
if (search.handleKeyEvent(ke)) {
int matchLine = search.currentMatchLine();
@@ -389,8 +387,7 @@ class SourceViewer {
if (markdownMode) {
TuiHelper.hint(spans, "Esc/c", "close");
TuiHelper.hint(spans, TuiIcons.HINT_SCROLL, "scroll");
- TuiHelper.hint(spans, "M", "markdown");
- TuiHelper.hint(spans, "R", "raw");
+ TuiHelper.hint(spans, "←→", "tab");
TuiHelper.hint(spans, "PgUp/PgDn", "page");
return;
}
@@ -405,13 +402,10 @@ class SourceViewer {
}
TuiHelper.hint(spans, TuiIcons.HINT_SCROLL, "navigate");
if (isMarkdownFile) {
- TuiHelper.hint(spans, "M", "markdown");
- TuiHelper.hint(spans, "R", "raw");
+ TuiHelper.hint(spans, "←→", "tab");
}
if (currentRouteId != null) {
- TuiHelper.hint(spans, "Y", "yaml");
- TuiHelper.hint(spans, "J", "java");
- TuiHelper.hint(spans, "X", "xml");
+ TuiHelper.hint(spans, "←→", "tab");
}
search.renderSearchHints(spans);
TuiHelper.hint(spans, "w", "wrap" + (wordWrap ? " [on]" : " [off]"));