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 /ranger | |
parent | d49cace95fb717d90e9d1e3b0088b0634071c0e3 (diff) | |
download | ranger-c5450bd180efd57f9cbd9d3315391b8cc8238be3.tar.gz |
console: fixed tabcompletion in openconsole starting with !xyz!
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/gui/widgets/console.py | 17 |
1 files changed, 13 insertions, 4 deletions
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) |