diff options
-rw-r--r-- | doc/ranger.1 | 7 | ||||
-rw-r--r-- | doc/ranger.pod | 3 | ||||
-rw-r--r-- | ranger/core/actions.py | 19 |
3 files changed, 25 insertions, 4 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1 index 7604e124..09bd94a4 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) +.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.9.2" "2019-02-24" "ranger manual" +.TH RANGER 1 "ranger-1.9.2" "2019-03-10" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -945,6 +945,9 @@ Start line numbers from 1. Possible values are: .IX Item "open_all_images [bool]" Open all images in this directory when running certain image viewers like feh or sxiv? You can still open selected files by marking them. +.Sp +If there would be too many files for the system to handle, this option +will be temporarily disabled automatically. .IP "padding_right [bool]" 4 .IX Item "padding_right [bool]" When collapse_preview is on and there is no preview, should there remain a diff --git a/doc/ranger.pod b/doc/ranger.pod index 3b9b92fc..e3419d0f 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -967,6 +967,9 @@ Start line numbers from 1. Possible values are: Open all images in this directory when running certain image viewers like feh or sxiv? You can still open selected files by marking them. +If there would be too many files for the system to handle, this option +will be temporarily disabled automatically. + =item padding_right [bool] When collapse_preview is on and there is no preview, should there remain a diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 8e98432a..75697696 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -410,7 +410,7 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m raise self.notify('Error in line `%s\':\n %s' % (line, str(ex)), bad=True) - def execute_file(self, files, **kw): + def execute_file(self, files, **kw): # pylint: disable=too-many-branches """Uses the "rifle" module to open/execute a file Arguments are the same as for ranger.ext.rifle.Rifle.execute: @@ -457,8 +457,23 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m self.signal_emit('execute.before', keywords=kw) filenames = [f.path for f in files] label = kw.get('label', kw.get('app', None)) - try: + + def execute(): return self.rifle.execute(filenames, mode, label, flags, None) + try: + return execute() + except OSError as err: + # Argument list too long. + if err.errno == 7 and self.settings.open_all_images: + old_value = self.settings.open_all_images + try: + self.notify("Too many files: Disabling open_all_images temporarily.") + self.settings.open_all_images = False + return execute() + finally: + self.settings.open_all_images = old_value + else: + raise finally: self.signal_emit('execute.after') |