File tree Expand file tree Collapse file tree
apps/desktop/src/lib/file-explorer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { tempDir, join } from '@tauri-apps/api/path'
1414import { getCachedIcon } from '$lib/icon-cache'
1515import { startSelectionDrag , prepareSelfDragOverlay , clearSelfDragOverlay } from '$lib/tauri-commands'
1616import { getSetting } from '$lib/settings/settings-store'
17+ import { cancelClickToRename } from '../rename/rename-activation'
1718import { renderDragImage } from './drag-image-renderer'
1819
1920/** Gets the drag threshold from settings (minimum distance in pixels to trigger drag) */
@@ -276,6 +277,9 @@ export function startSelectionDragTracking(
276277 const ctx = activeDrag . context
277278 const cbs = activeDrag . callbacks
278279
280+ // Stop any pending click-to-rename timer so it doesn't fire mid-drag.
281+ cancelClickToRename ( )
282+
279283 // For single-file drag, call onDragStart to select the file first
280284 if ( ctx . type === 'single' ) {
281285 cbs . onDragStart ?.( )
Original file line number Diff line number Diff line change 258258
259259 // Click-to-rename: if clicking the entry already under the cursor
260260 // (without Shift), start a timer that activates rename after 800ms.
261- // Skip when rename is already active.
261+ // Drag tracking still runs below so the cursor item remains draggable —
262+ // crossing the drag threshold cancels the rename timer.
262263 if (index === cursorIndex && ! event .shiftKey && ! renameState ?.active && onStartRename ) {
263264 startClickToRename (event , onStartRename )
264- return
265+ } else {
266+ // Clicking a different entry cancels any pending click-to-rename timer
267+ cancelClickToRename ()
265268 }
266269
267- // Clicking a different entry cancels any pending click-to-rename timer
268- cancelClickToRename ()
269-
270270 const hasSelection = selectedIndices .size > 0
271271
272272 if (! hasSelection ) {
Original file line number Diff line number Diff line change 252252
253253 // Click-to-rename: if clicking the entry already under the cursor
254254 // (without Shift), start a timer that activates rename after 800ms.
255- // Skip when rename is already active.
255+ // Drag tracking still runs below so the cursor item remains draggable —
256+ // crossing the drag threshold cancels the rename timer.
256257 if (index === cursorIndex && ! event .shiftKey && ! renameState ?.active && onStartRename ) {
257258 startClickToRename (event , onStartRename )
258- return
259+ } else {
260+ // Clicking a different entry cancels any pending click-to-rename timer
261+ cancelClickToRename ()
259262 }
260263
261- // Clicking a different entry cancels any pending click-to-rename timer
262- cancelClickToRename ()
263-
264264 const hasSelection = selectedIndices .size > 0
265265
266266 if (! hasSelection ) {
You can’t perform that action at this time.
0 commit comments