From 08752c957ad2de0a373eec26904a2af8528d54d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Ivan=C4=8Di=C4=8D?= Date: Fri, 23 Oct 2026 12:45:19 +0200 Subject: [PATCH 1/7] Add right-click selection mode in file lists - Allow toggling file marks on right click without showing context menu immediately - Support dragging with the right mouse button to mark/unmark multiple files with auto-scrolling - Show context menu on right-click long press (~500ms) or via keyboard (Shift+F10 / Menu key) - Add 'rightClickSelect' option in Settings -> Panels (with English and Czech translations) - Add 'cmd.toggleRightClickSelect' command to the command palette - Add unit tests for pointer context menu behavior --- src/components/FileGrid.svelte | 8 +- src/components/FileList.svelte | 8 +- src/components/dialogs/SettingsDialog.svelte | 1 + src/lib/commands.ts | 1 + src/lib/i18n/cs.ts | 2 + src/lib/i18n/en.ts | 2 + src/lib/pointer.test.ts | 31 ++++ src/lib/pointer.ts | 153 ++++++++++++++++++- src/lib/state/settings.svelte.ts | 3 + 9 files changed, 199 insertions(+), 10 deletions(-) create mode 100644 src/lib/pointer.test.ts diff --git a/src/components/FileGrid.svelte b/src/components/FileGrid.svelte index af440a6..65f6c75 100644 --- a/src/components/FileGrid.svelte +++ b/src/components/FileGrid.svelte @@ -6,7 +6,7 @@ import { drag } from '../lib/dnd.svelte'; import { setMetrics } from '../lib/panelKeys.svelte'; import { isWindows } from '../lib/platform'; - import { backgroundPointerDown, itemPointerDown } from '../lib/pointer'; + import { backgroundPointerDown, canOpenContextMenu, itemPointerDown } from '../lib/pointer'; import type { SideName } from '../lib/state/app.svelte'; import { settings } from '../lib/state/settings.svelte'; import type { Tab } from '../lib/state/tab.svelte'; @@ -105,8 +105,10 @@ function onContext(e: MouseEvent, entry: Entry | null) { e.preventDefault(); - if (entry && !(entry.flags & F.UP)) void entryMenu(tab); - else void backgroundMenu(tab); + if (canOpenContextMenu(e, entry)) { + if (entry && !(entry.flags & F.UP)) void entryMenu(tab); + else void backgroundMenu(tab); + } } diff --git a/src/components/FileList.svelte b/src/components/FileList.svelte index 7b79c67..1dcb14f 100644 --- a/src/components/FileList.svelte +++ b/src/components/FileList.svelte @@ -11,7 +11,7 @@ import { localeTag, t } from '../lib/i18n/index.svelte'; import { setMetrics } from '../lib/panelKeys.svelte'; import { isWindows } from '../lib/platform'; - import { backgroundPointerDown, itemPointerDown } from '../lib/pointer'; + import { backgroundPointerDown, canOpenContextMenu, itemPointerDown } from '../lib/pointer'; import type { SideName } from '../lib/state/app.svelte'; import { settings } from '../lib/state/settings.svelte'; import type { Tab } from '../lib/state/tab.svelte'; @@ -135,8 +135,10 @@ function onContext(e: MouseEvent, entry: Entry | null) { e.preventDefault(); - if (entry && !(entry.flags & F.UP)) void entryMenu(tab); - else void backgroundMenu(tab); + if (canOpenContextMenu(e, entry)) { + if (entry && !(entry.flags & F.UP)) void entryMenu(tab); + else void backgroundMenu(tab); + } } diff --git a/src/components/dialogs/SettingsDialog.svelte b/src/components/dialogs/SettingsDialog.svelte index 69acdd0..32de5cf 100644 --- a/src/components/dialogs/SettingsDialog.svelte +++ b/src/components/dialogs/SettingsDialog.svelte @@ -155,6 +155,7 @@ +