From e585341b690039acc7cbcac03c58c9aa56e2332e Mon Sep 17 00:00:00 2001 From: Radek Davidek Date: Tue, 20 Jan 2026 19:02:52 +0100 Subject: [PATCH] fixes in full mode --- .../cz/kamma/kfmanager/ui/FilePanelTab.java | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/main/java/cz/kamma/kfmanager/ui/FilePanelTab.java b/src/main/java/cz/kamma/kfmanager/ui/FilePanelTab.java index ba1d640..e78c430 100644 --- a/src/main/java/cz/kamma/kfmanager/ui/FilePanelTab.java +++ b/src/main/java/cz/kamma/kfmanager/ui/FilePanelTab.java @@ -553,17 +553,28 @@ public class FilePanelTab extends JPanel { // Enable horizontal scrollbar when needed so BRIEF mode can scroll left-right scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - // Implement mouse wheel navigation in BRIEF mode to match arrow key behavior + // Implement mouse wheel navigation in BRIEF and FULL mode to match arrow key behavior fileTable.addMouseWheelListener(new java.awt.event.MouseWheelListener() { @Override public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) { + int rotation = e.getWheelRotation(); + if (rotation == 0) return; + if (viewMode == ViewMode.BRIEF) { - int rotation = e.getWheelRotation(); - if (rotation != 0) { - // Navigate by one full column per wheel step - handleBriefNavigation(rotation > 0, tableModel.briefRowsPerColumn); - e.consume(); + // Navigate by one full column per wheel step + handleBriefNavigation(rotation > 0, tableModel.briefRowsPerColumn); + e.consume(); + } else if (viewMode == ViewMode.FULL) { + // Navigate by one item at a time in FULL mode + int currentRow = fileTable.getSelectedRow(); + int newRow = currentRow + (rotation > 0 ? 1 : -1); + + if (newRow >= 0 && newRow < fileTable.getRowCount()) { + fileTable.setRowSelectionInterval(newRow, newRow); + fileTable.scrollRectToVisible(fileTable.getCellRect(newRow, 0, true)); + updateStatus(); } + e.consume(); } } }); @@ -904,10 +915,17 @@ public class FilePanelTab extends JPanel { if (autoSelectFirst && fileTable.getRowCount() > 0) { int startIndex = 0; fileTable.setRowSelectionInterval(startIndex, startIndex); + // Ensure the first row (usually "..") is visible at the very top + SwingUtilities.invokeLater(() -> { + fileTable.scrollRectToVisible(fileTable.getCellRect(0, 0, true)); + }); } if (requestFocus) { SwingUtilities.invokeLater(() -> { - try { fileTable.requestFocusInWindow(); } catch (Exception ignore) {} + try { + fileTable.requestFocusInWindow(); + } catch (Exception ignore) { + } }); } }