diff options
author | nfnty <git@nfnty.se> | 2017-01-31 23:17:48 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-01-31 23:17:48 +0100 |
commit | bc83ff746bdce9d49b61cef26158840301ef214f (patch) | |
tree | 7735554bacef8ad7736fc790e7efd5afe204c7f9 | |
parent | 2775acde0be9d9a678a78f266afc65800aa31312 (diff) | |
parent | e3d16e54bb87c5b41503607e63989a518735896f (diff) |
Merge remote-tracking branch 'Klinkenstecker/quickjump-fixes' into quickjumpquickjump
-rw-r--r-- | ranger/config/commands.py | 15 | ||||
-rw-r--r-- | ranger/gui/quick_jump.py | 33 |
2 files changed, 18 insertions, 30 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index f66177df..cfbe7cbd 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1089,7 +1089,9 @@ class scout(Command): if self.MARK in flags or self.UNMARK in flags: value = flags.find(self.MARK) > flags.find(self.UNMARK) - if self.FILTER in flags: + if self.fm.ui.quick_jump.activated: + self.fm.mark_files(toggle=True, movedown=False) + elif self.FILTER in flags: for f in thisdir.files: thisdir.mark_item(f, value) else: @@ -1107,22 +1109,27 @@ class scout(Command): self.cancel() if self.OPEN_ON_ENTER in flags or \ - self.AUTO_OPEN in flags and count == 1: + self.AUTO_OPEN in flags and (count == 1 or quick_jump_active): if os.path.exists(pattern): self.fm.cd(pattern) else: self.fm.move(right=1) - if self.KEEP_OPEN in flags and thisdir != self.fm.thisdir: + if self.KEEP_OPEN in flags and \ + (thisdir != self.fm.thisdir or quick_jump_active): # reopen the console: cmd = self.line[0:-len(pattern)] if pattern else self.line - cmd = cmd.replace("q", "").replace("Q", "").strip() if quick_jump_active: + cmd = cmd.replace("q", "").replace("Q", "").strip() if quick_jump_paused: cmd = cmd + "Q " else: cmd = cmd + "q " self.fm.open_console(cmd) + # when quickjumps call execute() the concole isn't closed automatically + else: + self.fm.ui.console.close(True) + if self.quickly_executed and thisdir != self.fm.thisdir and pattern != "..": self.fm.block_input(0.5) diff --git a/ranger/gui/quick_jump.py b/ranger/gui/quick_jump.py index d34878db..854a660f 100644 --- a/ranger/gui/quick_jump.py +++ b/ranger/gui/quick_jump.py @@ -97,26 +97,6 @@ class QuickJump: def press(self, key): - # helper functions - def _move(): - target = self.fm.ui.browser.main_column.target - seq = self.key_sequence - if self.fm.settings.quick_jump_reverse_seq: - seq = seq[::-1] - line = int(baseconvert(seq, self.letter_base, BASE10)) - self.fm.move(to = line + self.fm.ui.browser.main_column.scroll_begin) - self.key_sequence = "" - if not target.empty(): - if self.scout.MARK in self.scout.flags: - self.fm.mark_files(toggle=True) - if self.scout.AUTO_OPEN in self.scout.flags and \ - target.files[target.pointer].is_directory: - self.fm.move(right = 1) - - if not self.scout.KEEP_OPEN in self.scout.flags: - self.fm.ui.console.close(True) - - # main function if not self.activated or self.paused: return False @@ -124,11 +104,6 @@ class QuickJump: if self.fm.ui.press(key): return True - # return key - if key == 10 and self.scout.MARK in self.scout.flags: - self.fm.mark_files(toggle=True) - return True - if key > 255 or not chr(key) in self.letter_base: return False @@ -136,6 +111,12 @@ class QuickJump: self.fm.ui.browser.main_column.request_redraw() if len(self.key_sequence) == self.levels: - _move() + target = self.fm.ui.browser.main_column.target + seq = self.key_sequence + if self.fm.settings.quick_jump_reverse_seq: + seq = seq[::-1] + line = int(baseconvert(seq, self.letter_base, BASE10)) + self.fm.move(to = line + self.fm.ui.browser.main_column.scroll_begin) + self.scout.execute() return True |