Allow optionally dropping anywhere

This commit is contained in:
Kovid Goyal
2026-04-20 09:24:33 +05:30
parent 44121ee82e
commit 235425ae85
2 changed files with 17 additions and 1 deletions

View File

@@ -128,7 +128,15 @@ func run_loop(opts *Options, drop_dests map[string]drop_dest, drag_sources map[s
} else if move_button_region.has(cell_x, cell_y) {
drop_status.action = move_on_drop
} else {
drop_status.action = 0
switch opts.DropAnywhere {
case "disallowed":
drop_status.action = 0
drop_status.accepted_mimes = nil
case "copy":
drop_status.action = copy_on_drop
case "move":
drop_status.action = move_on_drop
}
}
drop_status.in_window = cell_x > -1 && cell_y > -1
mimes_changed := !slices.Equal(prev_status.accepted_mimes, drop_status.accepted_mimes)

View File

@@ -27,6 +27,14 @@ files to be overwritten. Note that confirmation is asked only for actual file co
conflicting files are automatically created.
--drop-anywhere
choices=disallowed,copy,move
default=disallowed
type=choices
Allow dropping anywhere, not just on the Copy or Move drop regions. Dropping anywhere will perform
the specified action.
--machine-id
The machine id to use instead of the actual machine id.
'''.format