about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech@siewierski.eu>2020-07-05 13:55:04 +0200
committerGitHub <noreply@github.com>2020-07-05 13:55:04 +0200
commit0cc291b7608f8fcd8e0fc038578e4f5bf5aa4a0b (patch)
tree06a4c9e00e0c51f27956015d9a4479b36f34ed0a
parent617b736b35f09878039f49c79b517a844d405841 (diff)
parentb9f26f707f7e404e57c133c172ea6d1228446fe2 (diff)
downloadranger-0cc291b7608f8fcd8e0fc038578e4f5bf5aa4a0b.tar.gz
Merge pull request #1961 from toonn/pass-file
Revert "Revert "ranger <path> can select files""
-rw-r--r--ranger/core/tab.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index 1d5e69d4..7bb45d75 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -4,7 +4,7 @@
 from __future__ import (absolute_import, division, print_function)
 
 import os
-from os.path import abspath, normpath, join, expanduser, isdir
+from os.path import abspath, normpath, join, expanduser, isdir, dirname
 import sys
 
 from ranger.container import settings
@@ -123,9 +123,11 @@ class Tab(FileManagerAware, SettingsAware):  # pylint: disable=too-many-instance
 
         # get the absolute path
         path = normpath(join(self.path, expanduser(path)))
+        selectfile = None
 
         if not isdir(path):
-            return False
+            selectfile = path
+            path = dirname(path)
         new_thisdir = self.fm.get_directory(path)
 
         try:
@@ -155,6 +157,8 @@ class Tab(FileManagerAware, SettingsAware):  # pylint: disable=too-many-instance
         self.thisdir.sort_directories_first = self.fm.settings.sort_directories_first
         self.thisdir.sort_reverse = self.fm.settings.sort_reverse
         self.thisdir.sort_if_outdated()
+        if selectfile:
+            self.thisdir.move_to_obj(selectfile)
         if previous and previous.path != path:
             self.thisfile = self.thisdir.pointed_obj
         else: