diff options
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | ranger/core/actions.py | 4 | ||||
-rw-r--r-- | ranger/defaults/keys.py | 19 | ||||
-rw-r--r-- | ranger/gui/defaultui.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/console.py | 9 | ||||
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 2 |
6 files changed, 23 insertions, 17 deletions
diff --git a/TODO b/TODO index 715ebc1b..cab7eb04 100644 --- a/TODO +++ b/TODO @@ -51,6 +51,8 @@ General (X) #71 10/03/21 previews: black/whitelist + read file (X) #79 10/04/08 tab number zero ( ) #80 10/04/08 when closing tabs, avoid gaps? + ( ) #81 10/04/15 system crash when previewing /proc/kcore with root permissions + Bugs diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 2fd7d46d..4b4fc032 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -105,10 +105,10 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): """Redraw the window""" self.ui.redraw_window() - def open_console(self, mode=':', string=''): + def open_console(self, mode=':', string='', prompt=None): """Open the console if the current UI supports that""" if hasattr(self.ui, 'open_console'): - self.ui.open_console(mode, string) + self.ui.open_console(mode, string, prompt=prompt) def execute_file(self, files, **kw): """Execute a file. diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py index 5069f7b4..61138007 100644 --- a/ranger/defaults/keys.py +++ b/ranger/defaults/keys.py @@ -142,8 +142,8 @@ map('ud', fm.uncut()) map('pp', fm.paste()) map('po', fm.paste(overwrite=True)) map('pl', fm.paste_symlink()) -map('p<bg>', fm.hint('press //p// once again to confirm pasting' \ - ', or //l// to create symlinks')) +map('p<bg>', fm.hint('press *p* once again to confirm pasting' \ + ', or *l* to create symlinks')) # ---------------------------------------------------- run programs map('S', fm.execute_command(os.environ['SHELL'])) @@ -152,8 +152,8 @@ map('.term', fm.execute_command('x-terminal-emulator', flags='d')) map('du', fm.execute_command('du --max-depth=1 -h | less')) # -------------------------------------------------- toggle options -map('z<bg>', fm.hint("show_//h//idden //p//review_files" \ - "//d//irectories_first //c//ollapse_preview flush//i//nput")) +map('z<bg>', fm.hint("show_*h*idden *p*review_files" \ + "*d*irectories_first *c*ollapse_preview flush*i*nput")) map('zh', fm.toggle_boolean_option('show_hidden')) map('zp', fm.toggle_boolean_option('preview_files')) map('zi', fm.toggle_boolean_option('flushinput')) @@ -161,8 +161,8 @@ map('zd', fm.toggle_boolean_option('directories_first')) map('zc', fm.toggle_boolean_option('collapse_preview')) # ------------------------------------------------------------ sort -map('o<bg>', 'O<bg>', fm.hint("//s//ize //b//ase//n//ame //m//time" \ - " //t//ype //r//everse")) +map('o<bg>', 'O<bg>', fm.hint("*s*ize *b*ase*n*ame *m*time" \ + " *t*ype *r*everse")) sort_dict = { 's': 'size', 'b': 'basename', @@ -190,7 +190,7 @@ map('cw', fm.open_console(cmode.COMMAND, 'rename ')) map('cd', fm.open_console(cmode.COMMAND, 'cd ')) map('f', fm.open_console(cmode.COMMAND_QUICK, 'find ')) map('bf', fm.open_console(cmode.COMMAND, 'filter ')) -map('d<bg>', fm.hint('d//u// (disk usage) d//d// (cut)')) +map('d<bg>', fm.hint('d*u* (disk usage) d*d* (cut)')) map('@', fm.open_console(cmode.OPEN, '@')) map('#', fm.open_console(cmode.OPEN, 'p!')) @@ -227,7 +227,7 @@ map('ct', fm.search(order='tag')) map('cc', fm.search(order='ctime')) map('cm', fm.search(order='mimetype')) map('cs', fm.search(order='size')) -map('c<bg>', fm.hint('//c//time //m//imetype //s//ize')) +map('c<bg>', fm.hint('*c*time *m*imetype *s*ize')) # ------------------------------------------------------- bookmarks for key in ALLOWED_BOOKMARK_KEYS: @@ -258,7 +258,8 @@ def ctrl_c(arg): map(':', ';', fm.open_console(cmode.COMMAND)) map('>', fm.open_console(cmode.COMMAND_QUICK)) -map('!', 's', fm.open_console(cmode.OPEN)) +map('!', fm.open_console(cmode.OPEN, prompt='!')) +map('s', fm.open_console(cmode.OPEN, prompt='$')) map('r', fm.open_console(cmode.OPEN_QUICK)) diff --git a/ranger/gui/defaultui.py b/ranger/gui/defaultui.py index 08e0b204..a0a5da4e 100644 --- a/ranger/gui/defaultui.py +++ b/ranger/gui/defaultui.py @@ -93,8 +93,8 @@ class DefaultUI(UI): def close_embedded_pager(self): self.browser.close_pager() - def open_console(self, mode, string=''): - if self.console.open(mode, string): + def open_console(self, mode, string='', prompt=None): + if self.console.open(mode, string, prompt=prompt): self.status.msg = None self.console.on_close = self.close_console self.console.visible = True diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index c93a4f38..c81c66b5 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -112,9 +112,14 @@ class Console(Widget): except: pass - def open(self, mode, string=''): + def open(self, mode, string='', prompt=None): if not is_valid_mode(mode): return False + if prompt is not None: + assert isinstance(prompt, str) + self.prompt = prompt + elif 'prompt' in self.__dict__: + del self.prompt cls = mode_to_class(mode) @@ -420,8 +425,6 @@ class OpenConsole(ConsoleWithTab): def init(self): self.history = self.histories[OPEN_HISTORY] - OpenConsole.prompt = "{0}@{1} $ ".format(self.env.username, - self.env.hostname) def execute(self): command, flags = self._parse() diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index bff3d8ad..64c5e4c7 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -123,7 +123,7 @@ class StatusBar(Widget): highlight = True space_left = self.wid starting_point = self.x - for string in self.hint.split('//'): + for string in self.hint.split('*'): highlight = not highlight if highlight: self.color('in_statusbar', 'text', 'highlight') |