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

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

commit e3a4204082334b515febc1c910fac0112bc30333
Author: Luigi De Masi <[email protected]>
AuthorDate: Fri Oct 9 13:37:27 2026 +0200

    CAMEL-25491: Preserve log pinning outside Semantic inputs
    
    Limit the Ctrl+L exception to active Semantic inputs. Keep log pinning
    available in the existing search, filter and editor screens, with a
    regression test through global key dispatch.
    
    Co-authored-by: Codex <[email protected]>
---
 .../dsl/jbang/core/commands/tui/CamelMonitor.java  | 13 +++++++-----
 .../jbang/core/commands/tui/SemanticTabTest.java   | 23 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 5 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 57a608ec9162..586d3b65159b 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
@@ -1491,13 +1491,16 @@ public class CamelMonitor extends CamelCommand {
         boolean catalogFilterActive = tabRegistry.selectedTabIndex() == 
TAB_MORE
                 && tabRegistry.getActiveMoreTab() == tabRegistry.catalogTab()
                 && tabRegistry.catalogTab().isFilterInputActive();
-        boolean semanticInputActive = tabRegistry.selectedTabIndex() == 
TAB_MORE
-                && tabRegistry.getActiveMoreTab() == tabRegistry.semanticTab()
-                && tabRegistry.semanticTab().isInputActive();
         boolean filesBrowserTextActive = filesBrowser.isVisible() && 
filesBrowser.isSourceViewerTextInputActive();
         return probeEditing || sourceSearchActive || logSearchActive || 
spanFilterActive
                 || beanFilterActive || classpathFilterActive || 
mavenDepsFilterActive || sqlInputActive
-                || catalogFilterActive || semanticInputActive || 
filesBrowserTextActive;
+                || catalogFilterActive || isSemanticInputActive() || 
filesBrowserTextActive;
+    }
+
+    private boolean isSemanticInputActive() {
+        return tabRegistry.selectedTabIndex() == TAB_MORE
+                && tabRegistry.getActiveMoreTab() == tabRegistry.semanticTab()
+                && tabRegistry.semanticTab().isInputActive();
     }
 
     /**
@@ -1578,7 +1581,7 @@ public class CamelMonitor extends CamelCommand {
             }
             return true;
         }
-        if (ke.hasCtrl() && ke.isCharIgnoreCase('l') && !isTextInputActive()) {
+        if (ke.hasCtrl() && ke.isCharIgnoreCase('l') && 
!isSemanticInputActive()) {
             if (!logPinned) {
                 logPinned = true;
                 logPinAnim.reset(0);
diff --git 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticTabTest.java
 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticTabTest.java
index 6e1c4ef952fb..0618123ac32b 100644
--- 
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticTabTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticTabTest.java
@@ -722,6 +722,29 @@ class SemanticTabTest {
         }
     }
 
+    @Test
+    void logPinRemainsAvailableWhileOtherScreensHaveInputFocus() throws 
Exception {
+        try (var runtime = new Runtime()) {
+            var log = mock(LogTab.class);
+            when(log.isSearchInputActive()).thenReturn(true);
+            var registry = mock(TabRegistry.class);
+            when(registry.selectedTabIndex()).thenReturn(TabRegistry.TAB_LOG);
+            when(registry.logTab()).thenReturn(log);
+            when(registry.activeTab()).thenReturn(log);
+            var monitor = new CamelMonitor(new CamelJBangMain(), 
getClass().getClassLoader());
+            var registryField = 
CamelMonitor.class.getDeclaredField("tabRegistry");
+            registryField.setAccessible(true);
+            registryField.set(monitor, registry);
+            var contextField = CamelMonitor.class.getDeclaredField("ctx");
+            contextField.setAccessible(true);
+            contextField.set(monitor, runtime);
+            var global = 
CamelMonitor.class.getDeclaredMethod("handleGlobalKeys", KeyEvent.class, 
TuiRunner.class);
+            global.setAccessible(true);
+            assertThat(global.invoke(monitor, KeyEvent.ofChar('l', 
KeyModifiers.CTRL), null)).isEqualTo(true);
+            assertThat(runtime.logPinned).isTrue();
+        }
+    }
+
     @Test
     void operationDraftsAndExplicitParameterCopiesSurviveSwitching() throws 
Exception {
         try (var runtime = new Runtime()) {

Reply via email to