From 1f124acd4a650a0f7ecb72c3abdd675c0c04e353 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 15 Jul 2015 00:06:02 +0200 Subject: rc.conf: added pP/pO keys for FIFO-queued copying, fixes #345 --- doc/ranger.1 | 8 ++++++-- doc/ranger.pod | 5 +++++ ranger/config/rc.conf | 2 ++ ranger/core/actions.py | 5 +++-- ranger/core/loader.py | 10 ++++++++-- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/doc/ranger.1 b/doc/ranger.1 index 42eca7e6..ea720903 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.7.1" "05/04/2015" "ranger manual" +.TH RANGER 1 "ranger-1.7.1" "07/15/2015" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -497,6 +497,10 @@ modern \s-1GUI\s0 programs. .IP "po" 14 .IX Item "po" Paste the copied/cut files, overwriting existing files. +.IP "pP, pO" 14 +.IX Item "pP, pO" +Like pp and po, but queues the operation so that it will be executed \fIafter\fR +any other operations. Reminder: type \f(CW\*(C`w\*(C'\fR to open the task window. .IP "pl, pL" 14 .IX Item "pl, pL" Create symlinks (absolute or relative) to the copied files diff --git a/doc/ranger.pod b/doc/ranger.pod index ab84de2c..b68595a9 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -418,6 +418,11 @@ modern GUI programs. Paste the copied/cut files, overwriting existing files. +=item pP, pO + +Like pp and po, but queues the operation so that it will be executed I +any other operations. Reminder: type C to open the task window. + =item pl, pL Create symlinks (absolute or relative) to the copied files diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index f34b6e0c..bb9af151 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -344,6 +344,8 @@ map I eval fm.open_console('rename ' + fm.thisfile.relative_path, position=7) map pp paste map po paste overwrite=True +map pP paste append=True +map pO paste overwrite=True append=True map pl paste_symlink relative=False map pL paste_symlink relative=True map phl paste_hardlink diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 442182ff..e3dba313 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1217,9 +1217,10 @@ class Actions(FileManagerAware, SettingsAware): link(source_path, next_available_filename(target_path)) - def paste(self, overwrite=False): + def paste(self, overwrite=False, append=False): """Paste the selected items into the current directory""" - self.loader.add(CopyLoader(self.copy_buffer, self.do_cut, overwrite)) + loadable = CopyLoader(self.copy_buffer, self.do_cut, overwrite) + self.loader.add(loadable, append=append) self.do_cut = False def delete(self): diff --git a/ranger/core/loader.py b/ranger/core/loader.py index 8eda544f..f4694eca 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -275,14 +275,20 @@ class Loader(FileManagerAware): (self.throbber_status + 1) % len(self.throbber_chars) self.status = self.throbber_chars[self.throbber_status] - def add(self, obj): + def add(self, obj, append=False): """Add an object to the queue. It should have a load_generator method. + + If the argument "append" is True, the queued object will be processed + last, not first. """ while obj in self.queue: self.queue.remove(obj) - self.queue.appendleft(obj) + if append: + self.queue.append(obj) + else: + self.queue.appendleft(obj) if self.paused: obj.pause() else: -- cgit 1.4.1-2-gfad0