This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/CAMEL-23862 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8934b8d4ed02f4199995fbc8e48599a15ea9df6b Author: Claus Ibsen <[email protected]> AuthorDate: Tue Jun 30 19:32:46 2026 +0200 CAMEL-23862: SQL Trace - fix cursor navigation in master table Remove identity tracking that was overriding user navigation on every render cycle. Cursor now stays at its index position while new entries scroll in at the top. Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/dsl/jbang/core/commands/tui/SqlTraceTab.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTab.java b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTab.java index b68b8acf49af..0d1ba4a558c1 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTab.java +++ b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SqlTraceTab.java @@ -60,7 +60,6 @@ class SqlTraceTab implements MonitorTab { private boolean sortReversed; private int detailScroll; private boolean wordWrap = true; - private String selectedKey; SqlTraceTab(MonitorContext ctx) { this.ctx = ctx; @@ -174,29 +173,19 @@ class SqlTraceTab implements MonitorTab { frame.renderWidget(kpi, area); } - private static String traceKey(SqlTraceInfo si) { - return si.exchangeId + "@" + si.timestamp; - } - private void renderMasterDetail(Frame frame, Rect area, IntegrationInfo info) { List<SqlTraceInfo> sorted = new ArrayList<>(info.sqlTraceStatements); sorted.sort(this::sortTrace); - // restore selection by identity so cursor follows the same row when new data arrives - if (selectedKey != null) { - for (int i = 0; i < sorted.size(); i++) { - if (selectedKey.equals(traceKey(sorted.get(i)))) { - tableState.select(i); - break; - } - } + // auto-select first row when data arrives + if (!sorted.isEmpty() && tableState.selected() == null) { + tableState.select(0); } SqlTraceInfo selected = null; Integer sel = tableState.selected(); if (sel != null && sel >= 0 && sel < sorted.size()) { selected = sorted.get(sel); - selectedKey = traceKey(selected); } boolean showDetail = selected != null;
