diff --git a/kittens/dnd/main.go b/kittens/dnd/main.go index 38b677338..823524ce2 100644 --- a/kittens/dnd/main.go +++ b/kittens/dnd/main.go @@ -113,7 +113,8 @@ func run_loop(opts *Options, drop_dests map[string]drop_dest, drag_sources map[s // If allow_drags, start a drag when the terminal sends the t=o // event. Presend data for any drag_source objects that have non nil // data fields and whose data size is <= 1MB. Set drag_started to true. - // reset drag_started at the end of the drag. + // reset drag_started at the end of the drag. Use opts.DragAction to + // set what actions are allowed. // If a drop enters the window and has one or more MIME types present // in drop_dests, accept the drop, unless drag_started is true. @@ -132,6 +133,17 @@ func run_loop(opts *Options, drop_dests map[string]drop_dest, drag_sources map[s // progress the render_screen() function should hide the drop // destination buttons and instead show the text "Drop in progress, // reading data..." + // Be very careful when writing dropped data from uri-list nothing + // should be written outside the destination directory (the current + // working directory by default). In particular, symlinks must be + // handled with care. + + // When acting as a drag source, dont forget to implement support for + // remote dragging, which means providing data for the text/uri-list + // mime type file:// entries when the terminal requests it using the + // dnd protocol. If the action chosen is move, delete the files + // corresponding to the drag sources, including the files in the + // uri-list and exit. return nil } diff --git a/kittens/dnd/main.py b/kittens/dnd/main.py index ad7fac127..d32c2f724 100644 --- a/kittens/dnd/main.py +++ b/kittens/dnd/main.py @@ -24,7 +24,16 @@ text/uri-list. type=bool-set Ask for confirmation when dropping text/uri-list data if the drop will cause any existing files to be overwritten. Note that confirmation is asked only for actual file conflicts, non -conflicting files are automatically created, always. +conflicting files are automatically created. + + +--drag-action +type=choices +default=copy +choices=copy,move,either +The set of allowed actions when dragging. If :code:`either` is chosen then the drop destination can pick +which action it wants. If the action is a move, then the dragged files are deleted when the drag finishes +and the kitten exits after the drag. '''.format help_text = '''\