From 2fdea4dc6bbc5d3519569b4d8dadd504d3df9079 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Mon, 13 Apr 2026 23:14:45 +0300 Subject: [PATCH] Fixed terminal scrollbar disappearing when choice/confirmation prompt shown splitPane.setEnabled(false) propagated to all child components, including the terminal widget's scrollbar, making it unresponsive while the choice menu was visible. Fix: disable only the divider via BasicSplitPaneUI.getDivider().setEnabled() so the user cannot drag the splitter but the terminal remains fully interactive. Resolves: #22 Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 1 + .../nbclaudecodegui/ui/ClaudeSessionTab.java | 9 +++- .../ui/ChoiceMenuPanelTest.java | 50 +++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5277a694..c14fd408 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Fixed terminal scrollbar disappearing when Claude shows a choice/confirmation prompt (https://github.com/nbclaudecodegui/NetbeansClaudeCodeGui/issues/22) - Fixed Cancel button sending Ctrl+C instead of Esc, making it impossible to exit /usage and similar screens - Fixed "Open with Claude Code" context menu not applying Default profile settings (API key, proxy, Extra CLI args, etc.) (https://github.com/nbclaudecodegui/NetbeansClaudeCodeGui/issues/23) - Added alphabetical sorting to the "Select Project" dropdown (https://github.com/nbclaudecodegui/NetbeansClaudeCodeGui/issues/21) diff --git a/src/main/java/io/github/nbclaudecodegui/ui/ClaudeSessionTab.java b/src/main/java/io/github/nbclaudecodegui/ui/ClaudeSessionTab.java index 74104536..e30308e8 100644 --- a/src/main/java/io/github/nbclaudecodegui/ui/ClaudeSessionTab.java +++ b/src/main/java/io/github/nbclaudecodegui/ui/ClaudeSessionTab.java @@ -894,7 +894,14 @@ private void switchSouthCard(String card) { if (southCard == null || southCardLayout == null) return; activeCard = card; southCardLayout.show(southCard, card); - splitPane.setEnabled(!CARD_CHOICE.equals(card)); + // Disable only the divider when the choice menu is shown, not the whole + // splitPane. setEnabled(false) on the splitPane propagates to all child + // components including the terminal widget's scrollbar, making it + // unresponsive. Disabling only the divider prevents the user from + // dragging the splitter while leaving the terminal fully interactive. + if (splitPane.getUI() instanceof javax.swing.plaf.basic.BasicSplitPaneUI ui) { + ui.getDivider().setEnabled(!CARD_CHOICE.equals(card)); + } if (!CARD_CHOICE.equals(card)) { // restore divider for this card int total = splitPane.getHeight(); diff --git a/src/test/java/io/github/nbclaudecodegui/ui/ChoiceMenuPanelTest.java b/src/test/java/io/github/nbclaudecodegui/ui/ChoiceMenuPanelTest.java index a1804494..3426534c 100644 --- a/src/test/java/io/github/nbclaudecodegui/ui/ChoiceMenuPanelTest.java +++ b/src/test/java/io/github/nbclaudecodegui/ui/ChoiceMenuPanelTest.java @@ -638,6 +638,56 @@ void preferredHeightAfterSplitPaneValidateCoversAllContent() throws Exception { }); } + // ------------------------------------------------------------------------- + // Regression: splitPane must stay enabled when choice menu is shown (#22) + // ------------------------------------------------------------------------- + + /** + * Regression test for issue #22: showing the choice menu must not disable + * the {@link JSplitPane}. Disabling the whole splitPane propagated to all + * child components including the terminal scrollbar, making it unresponsive. + * The fix disables only the divider via {@code BasicSplitPaneUI.getDivider()}. + */ + @Test + void splitPaneRemainsEnabledWhenChoiceMenuShown() throws Exception { + SwingUtilities.invokeAndWait(() -> { + ChoiceMenuPanel choiceMenuPanel = new ChoiceMenuPanel(() -> null); + JPanel promptPanel = new JPanel(); + + java.awt.CardLayout cardLayout = new java.awt.CardLayout(); + JPanel southCard = new JPanel(cardLayout); + southCard.add(promptPanel, "prompt"); + southCard.add(choiceMenuPanel, "choice"); + + JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + new JPanel(), southCard); + + JFrame frame = new JFrame(); + frame.add(splitPane); + frame.setSize(400, 600); + frame.setVisible(true); + + try { + choiceMenuPanel.show(new ChoiceMenuModel("Continue?", + List.of(new Option("Yes", "1"), new Option("No", "2")), -1), + answer -> {}); + cardLayout.show(southCard, "choice"); + + // Simulate the production switchSouthCard(CARD_CHOICE) path: + // only the divider is disabled, not the whole splitPane. + if (splitPane.getUI() instanceof javax.swing.plaf.basic.BasicSplitPaneUI ui) { + ui.getDivider().setEnabled(false); + } + + assertTrue(splitPane.isEnabled(), + "splitPane must remain enabled when choice menu is shown — " + + "disabling it would also disable the terminal scrollbar (issue #22)"); + } finally { + frame.dispose(); + } + }); + } + // ------------------------------------------------------------------------- // helpers // -------------------------------------------------------------------------