summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorMarcel Partap <mpartap@gmx.net>2019-09-11 10:35:52 +0200
committerGitHub <noreply@github.com>2019-09-11 10:35:52 +0200
commit02714ab883bff9e807d9e78951eebfdb027bdcf1 (patch)
treefeaa42835a8ea5b428f770792b306d3e64f8d11e /ranger
parent40350d99009cbb537e3a8e6d13ca8f37cfc3a73b (diff)
parent86281229606e147870b365d7aff445e394883674 (diff)
downloadranger-02714ab883bff9e807d9e78951eebfdb027bdcf1.tar.gz
Merge branch 'master' into fix-status-bar-position
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/config/commands.py6
-rw-r--r--ranger/config/rc.conf5
-rw-r--r--ranger/container/settings.py2
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/core/main.py10
-rwxr-xr-xranger/data/scope.sh1
6 files changed, 21 insertions, 5 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 2b1f4940..55dd9cd1 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -572,7 +572,7 @@ class default_linemode(Command):
 class quit(Command):  # pylint: disable=redefined-builtin
     """:quit
 
-    Closes the current tab, if there's only one tab.
+    Closes the current tab, if there's more than one tab.
     Otherwise quits if there are no tasks in progress.
     """
     def _exit_no_work(self):
@@ -591,7 +591,7 @@ class quit(Command):  # pylint: disable=redefined-builtin
 class quit_bang(Command):
     """:quit!
 
-    Closes the current tab, if there's only one tab.
+    Closes the current tab, if there's more than one tab.
     Otherwise force quits immediately.
     """
     name = 'quit!'
@@ -1244,7 +1244,7 @@ class copycmap(copymap):
 
 
 class copytmap(copymap):
-    """:copycmap <keys> <newkeys1> [<newkeys2>...]
+    """:copytmap <keys> <newkeys1> [<newkeys2>...]
 
     Copies a "taskview" keybinding from <keys> to <newkeys>
     """
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index f559290d..00a20def 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -301,6 +301,11 @@ set freeze_files false
 # Print file sizes in bytes instead of the default human-readable format.
 set size_in_bytes false
 
+# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words
+# give a warning when you nest ranger in a subshell started by ranger.
+# Special value "error" makes the warning more visible.
+set nested_ranger_warning true
+
 # ===================================================================
 # == Local Options
 # ===================================================================
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index d15f8b3b..82901ac0 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -58,6 +58,7 @@ ALLOWED_SETTINGS = {
     'max_history_size': (int, type(None)),
     'metadata_deep_search': bool,
     'mouse_enabled': bool,
+    'nested_ranger_warning': str,
     'one_indexed': bool,
     'open_all_images': bool,
     'padding_right': bool,
@@ -105,6 +106,7 @@ ALLOWED_VALUES = {
     'confirm_on_delete': ['multiple', 'always', 'never'],
     'draw_borders': ['none', 'both', 'outline', 'separators'],
     'line_numbers': ['false', 'absolute', 'relative'],
+    'nested_ranger_warning': ['true', 'false', 'error'],
     'one_indexed': [False, True],
     'preview_images_method': ['w3m', 'iterm2', 'terminology',
                               'urxvt', 'urxvt-full', 'kitty',
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 435fcf13..25b01e2c 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -1607,10 +1607,10 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
 
     def delete(self, files=None):
         # XXX: warn when deleting mount points/unseen marked files?
-        self.notify("Deleting!")
         # COMPAT: old command.py use fm.delete() without arguments
         if files is None:
             files = (fobj.path for fobj in self.thistab.get_selection())
+        self.notify("Deleting {}!".format(", ".join(files)))
         files = [os.path.abspath(path) for path in files]
         for path in files:
             # Untag the deleted files.
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 23648677..aefaacbc 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -180,6 +180,16 @@ def main(
             for command in args.cmd:
                 fm.execute_console(command)
 
+        if int(os.environ[level]) > 1:
+            warning = 'Warning:'
+            nested_warning = "You're in a nested ranger instance!"
+            warn_when_nested = fm.settings.nested_ranger_warning.lower()
+            if warn_when_nested == 'true':
+                fm.notify(' '.join((warning, nested_warning)), bad=False)
+            elif warn_when_nested == 'error':
+                fm.notify(' '.join((warning.upper(), nested_warning + '!!')),
+                          bad=True)
+
         if ranger.args.profile:
             import cProfile
             import pstats
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 306eeed0..eb09b2bf 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -45,7 +45,6 @@ HIGHLIGHT_STYLE=${HIGHLIGHT_STYLE:-pablo}
 HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
 PYGMENTIZE_STYLE=${PYGMENTIZE_STYLE:-autumn}
 
-
 handle_extension() {
     case "${FILE_EXTENSION_LOWER}" in
         ## Archive