You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/05/13 21:03:40 UTC
(camel) 02/07: CAMEL-23512: Use TamboUI semantic key bindings instead of raw KeyCode checks
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch CAMEL-23512-fix-tui-tamboui-api
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1623c67b7afcbf09637d80015dea731c4685fb89
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed May 13 22:10:15 2026 +0200
CAMEL-23512: Use TamboUI semantic key bindings instead of raw KeyCode checks
Replace raw KeyCode checks with semantic binding methods so vim/emacs
key bindings are respected automatically via TamboUI's binding system.
Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
---
.../dsl/jbang/core/commands/tui/CamelCatalogTui.java | 16 ++++++++--------
.../camel/dsl/jbang/core/commands/tui/CamelMonitor.java | 15 +++++++--------
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelCatalogTui.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelCatalogTui.java
index 6b2ffc12e9b3..9c77fe24cfe0 100644
--- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelCatalogTui.java
+++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelCatalogTui.java
@@ -268,7 +268,7 @@ public class CamelCatalogTui extends CamelCommand {
}
// Escape: clear filter first, then go back, then quit
- if (ke.isKey(KeyCode.ESCAPE)) {
+ if (ke.isCancel()) {
if (focus == FOCUS_OPTIONS && (!optionFilter.isEmpty() || optionFullText)) {
optionFilter.setLength(0);
optionFullText = false;
@@ -291,7 +291,7 @@ public class CamelCatalogTui extends CamelCommand {
}
// Backspace: delete from active filter
- if (ke.isKey(KeyCode.BACKSPACE)) {
+ if (ke.isDeleteBackward()) {
if (focus == FOCUS_LIST && !componentFilter.isEmpty()) {
componentFilter.deleteCharAt(componentFilter.length() - 1);
applyComponentFilter();
@@ -303,7 +303,7 @@ public class CamelCatalogTui extends CamelCommand {
}
// Panel switching — only when no active filter on current panel
- if (ke.isKey(KeyCode.TAB)) {
+ if (ke.isFocusNext()) {
if (focus == FOCUS_LIST) {
focus = FOCUS_OPTIONS;
} else {
@@ -312,19 +312,19 @@ public class CamelCatalogTui extends CamelCommand {
descriptionScroll = 0;
return true;
}
- if (ke.isKey(KeyCode.RIGHT) && focus == FOCUS_LIST) {
+ if (ke.isRight() && focus == FOCUS_LIST) {
focus = FOCUS_OPTIONS;
descriptionScroll = 0;
return true;
}
- if (ke.isKey(KeyCode.LEFT) && focus == FOCUS_OPTIONS) {
+ if (ke.isLeft() && focus == FOCUS_OPTIONS) {
focus = FOCUS_LIST;
descriptionScroll = 0;
return true;
}
// Enter drills into options
- if (ke.isKey(KeyCode.ENTER) && focus == FOCUS_LIST) {
+ if (ke.isConfirm() && focus == FOCUS_LIST) {
focus = FOCUS_OPTIONS;
descriptionScroll = 0;
return true;
@@ -351,11 +351,11 @@ public class CamelCatalogTui extends CamelCommand {
}
return true;
}
- if (ke.isKey(KeyCode.PAGE_UP)) {
+ if (ke.isPageUp()) {
descriptionScroll = Math.max(0, descriptionScroll - 5);
return true;
}
- if (ke.isKey(KeyCode.PAGE_DOWN)) {
+ if (ke.isPageDown()) {
descriptionScroll += 5;
return true;
}
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 ea17f985877c..f04aad0c7408 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
@@ -56,7 +56,6 @@ import dev.tamboui.text.Text;
import dev.tamboui.tui.TuiConfig;
import dev.tamboui.tui.TuiRunner;
import dev.tamboui.tui.event.Event;
-import dev.tamboui.tui.event.KeyCode;
import dev.tamboui.tui.event.KeyEvent;
import dev.tamboui.tui.event.MouseEvent;
import dev.tamboui.tui.event.MouseEventKind;
@@ -238,7 +237,7 @@ public class CamelMonitor extends CamelCommand {
}
if (event instanceof KeyEvent ke) {
// Global keys
- if (ke.isQuit() || ke.isCharIgnoreCase('q') || ke.isKey(KeyCode.ESCAPE)) {
+ if (ke.isQuit() || ke.isCharIgnoreCase('q') || ke.isCancel()) {
if (showDiagram) {
showDiagram = false;
diagramImageData = null;
@@ -280,7 +279,7 @@ public class CamelMonitor extends CamelCommand {
}
// Tab cycling
- if (ke.isKey(KeyCode.TAB)) {
+ if (ke.isFocusNext()) {
int next = (tabsState.selected() + 1) % NUM_TABS;
if (next != TAB_OVERVIEW) {
selectCurrentIntegration();
@@ -309,7 +308,7 @@ public class CamelMonitor extends CamelCommand {
}
return true;
}
- if (ke.isKey(KeyCode.PAGE_UP)) {
+ if (ke.isPageUp()) {
if (showDiagram && tab == TAB_ROUTES) {
diagramScroll = Math.max(0, diagramScroll - 20);
} else if (tab == TAB_LOG) {
@@ -320,7 +319,7 @@ public class CamelMonitor extends CamelCommand {
}
return true;
}
- if (ke.isKey(KeyCode.PAGE_DOWN)) {
+ if (ke.isPageDown()) {
if (showDiagram && tab == TAB_ROUTES) {
diagramScroll += 20;
} else if (tab == TAB_LOG) {
@@ -342,14 +341,14 @@ public class CamelMonitor extends CamelCommand {
return true;
}
}
- if (ke.isKey(KeyCode.HOME)) {
+ if (ke.isHome()) {
if (showDiagram && tab == TAB_ROUTES) {
diagramScroll = 0;
diagramScrollX = 0;
return true;
}
}
- if (ke.isKey(KeyCode.END)) {
+ if (ke.isEnd()) {
if (showDiagram && tab == TAB_ROUTES) {
diagramScroll = Integer.MAX_VALUE;
return true;
@@ -357,7 +356,7 @@ public class CamelMonitor extends CamelCommand {
}
// Enter to drill into selected integration
- if (ke.isKey(KeyCode.ENTER) && tab == TAB_OVERVIEW) {
+ if (ke.isConfirm() && tab == TAB_OVERVIEW) {
selectCurrentIntegration();
if (selectedPid != null) {
tabsState.select(TAB_ROUTES);