Skip to content

Commit f03bce6

Browse files
oleg68Oleg Samarinclaude
authored
Fixed terminal scrollbar disappearing when choice/confirmation prompt shown (#41)
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: Oleg Samarin <osamarin@openintegration.inc> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f39f702 commit f03bce6

3 files changed

Lines changed: 59 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
- Fixed terminal scrollbar disappearing when Claude shows a choice/confirmation prompt (https://github.com/nbclaudecodegui/NetbeansClaudeCodeGui/issues/22)
12
- Fixed Cancel button sending Ctrl+C instead of Esc, making it impossible to exit /usage and similar screens
23
- Fixed Default profile settings not saving in Tools → Options → Profiles (https://github.com/nbclaudecodegui/NetbeansClaudeCodeGui/issues/31)
34
- 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)

‎src/main/java/io/github/nbclaudecodegui/ui/ClaudeSessionTab.java‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,14 @@ private void switchSouthCard(String card) {
787787
if (southCard == null || southCardLayout == null) return;
788788
activeCard = card;
789789
southCardLayout.show(southCard, card);
790-
splitPane.setEnabled(!CARD_CHOICE.equals(card));
790+
// Disable only the divider when the choice menu is shown, not the whole
791+
// splitPane. setEnabled(false) on the splitPane propagates to all child
792+
// components including the terminal widget's scrollbar, making it
793+
// unresponsive. Disabling only the divider prevents the user from
794+
// dragging the splitter while leaving the terminal fully interactive.
795+
if (splitPane.getUI() instanceof javax.swing.plaf.basic.BasicSplitPaneUI ui) {
796+
ui.getDivider().setEnabled(!CARD_CHOICE.equals(card));
797+
}
791798
if (!CARD_CHOICE.equals(card)) {
792799
// restore divider for this card
793800
int total = splitPane.getHeight();

‎src/test/java/io/github/nbclaudecodegui/ui/ChoiceMenuPanelTest.java‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,56 @@ void preferredHeightAfterSplitPaneValidateCoversAllContent() throws Exception {
637637
});
638638
}
639639

640+
// -------------------------------------------------------------------------
641+
// Regression: splitPane must stay enabled when choice menu is shown (#22)
642+
// -------------------------------------------------------------------------
643+
644+
/**
645+
* Regression test for issue #22: showing the choice menu must not disable
646+
* the {@link JSplitPane}. Disabling the whole splitPane propagated to all
647+
* child components including the terminal scrollbar, making it unresponsive.
648+
* The fix disables only the divider via {@code BasicSplitPaneUI.getDivider()}.
649+
*/
650+
@Test
651+
void splitPaneRemainsEnabledWhenChoiceMenuShown() throws Exception {
652+
SwingUtilities.invokeAndWait(() -> {
653+
ChoiceMenuPanel choiceMenuPanel = new ChoiceMenuPanel(() -> null);
654+
JPanel promptPanel = new JPanel();
655+
656+
java.awt.CardLayout cardLayout = new java.awt.CardLayout();
657+
JPanel southCard = new JPanel(cardLayout);
658+
southCard.add(promptPanel, "prompt");
659+
southCard.add(choiceMenuPanel, "choice");
660+
661+
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
662+
new JPanel(), southCard);
663+
664+
JFrame frame = new JFrame();
665+
frame.add(splitPane);
666+
frame.setSize(400, 600);
667+
frame.setVisible(true);
668+
669+
try {
670+
choiceMenuPanel.show(new ChoiceMenuModel("Continue?",
671+
List.of(new Option("Yes", "1"), new Option("No", "2")), -1),
672+
answer -> {});
673+
cardLayout.show(southCard, "choice");
674+
675+
// Simulate the production switchSouthCard(CARD_CHOICE) path:
676+
// only the divider is disabled, not the whole splitPane.
677+
if (splitPane.getUI() instanceof javax.swing.plaf.basic.BasicSplitPaneUI ui) {
678+
ui.getDivider().setEnabled(false);
679+
}
680+
681+
assertTrue(splitPane.isEnabled(),
682+
"splitPane must remain enabled when choice menu is shown — " +
683+
"disabling it would also disable the terminal scrollbar (issue #22)");
684+
} finally {
685+
frame.dispose();
686+
}
687+
});
688+
}
689+
640690
// -------------------------------------------------------------------------
641691
// helpers
642692
// -------------------------------------------------------------------------

0 commit comments

Comments
 (0)