diff options
author | hut <hut@lavabit.com> | 2010-02-24 15:35:16 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-02-24 23:54:17 +0100 |
commit | c5450bd180efd57f9cbd9d3315391b8cc8238be3 (patch) | |
tree | 76df12e4f869edbdce46de903ad7b66f3179e30a | |
parent | d49cace95fb717d90e9d1e3b0088b0634071c0e3 (diff) | |
download | ranger-c5450bd180efd57f9cbd9d3315391b8cc8238be3.tar.gz |
console: fixed tabcompletion in openconsole starting with !xyz!
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | ranger/gui/widgets/console.py | 17 |
2 files changed, 14 insertions, 4 deletions
diff --git a/TODO b/TODO index 466ab8f4..d475f099 100644 --- a/TODO +++ b/TODO @@ -57,6 +57,7 @@ Bugs (X) #26 10/01/06 :delete on symlinks of directories fails (X) #31 10/01/06 ^C breaks cd-after-exit by stopping sourced shell script ( ) #40 10/01/17 freeze with unavailable sshfs + Looks like I need threads for that... (X) #41 10/01/17 capital file extensions are not recognized (X) #46 10/01/19 old username displayed after using su (X) #49 10/01/19 fix unit tests :'( diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index a496f6a9..5439b2a8 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -396,11 +396,20 @@ class OpenConsole(ConsoleWithTab): def _get_tab(self): try: - position_of_last_space = self.line.rindex(" ") + i = self.line.index('!')+1 except ValueError: - return (program + ' ' for program in self.fm.executables \ - if program.startswith(self.line)) - if position_of_last_space == len(self.line) - 1: + line = self.line + start = '' + else: + line = self.line[i:] + start = self.line[:i] + + try: + position_of_last_space = line.rindex(" ") + except ValueError: + return (start + program + ' ' for program in self.fm.executables \ + if program.startswith(line)) + if position_of_last_space == len(line) - 1: return self.line + '%s ' else: before_word, start_of_word = self.line.rsplit(' ', 1) |