summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* defaults.keys: added keys gl and gL to resolve linkshut2010-08-252-1/+6
|
* Fixed exception when using %f macros in special caseshut2010-08-161-2/+4
|
* defaults.keys: map <backspace> to ^H (since ^H is bugged sometimes)hut2010-08-131-1/+1
|
* shared.mimetype: look for mimetypes in ~/.mime.typeshut2010-08-121-0/+3
|
* defaults.keys: added keys da, dr, ya, yr + documentationhut2010-07-233-5/+21
|
* gui.widgets.console: added %<LETTER> and %<N><letter> macroshut2010-07-172-1/+41
| | | | | See also: http://lists.nongnu.org/archive/html/ranger-users/2010-07/msg00001.html
* help.console: typohut2010-07-171-1/+1
|
* defaults.apps: make pager accept ansi color codeshut2010-07-171-1/+1
| | | | This fixes the :grep command on some OSes
* Why did the astrophysicist order three hamburgers? v1.1.2hut2010-07-124-3/+9
|
* defaults.keys: improved "du" keybindinghut2010-07-051-1/+2
|
* core.actions: added "execute_console"hut2010-07-031-0/+6
|
* Fixed default keyword argument value "mode" for fm.open_consolehut2010-07-031-1/+1
|
* ext.human_readable: fixedhut2010-06-251-5/+5
|
* tc_human_readable: additional testcase (which fails)hut2010-06-251-0/+4
|
* ext.human_readable: more efficient implementationhut2010-06-243-19/+120
| | | | plus unit tests and benchmark.
* README: added design goals sectionhut2010-06-241-0/+9
|
* README: formatting, cleanuphut2010-06-241-4/+4
|
* Makefile: simplificationhut2010-06-241-1/+1
|
* ranger.main: ranger dir1 dir2 [...] opens multiple tabshut2010-06-241-7/+6
|
* removed pydoc since it can be generated with "make doc" easilyhut2010-06-2146-6669/+0
|
* make doc: minor cleanup and fixhut2010-06-211-2/+2
|
* commited pydocs are author agnosticshpelda2010-06-211-1/+2
|
* core.actions: Fixed indexerror in move_parent()hut2010-06-201-1/+4
|
* version = version + 1 v1.1.1hut2010-06-187-9/+11
|
* added CHANGELOGhut2010-06-181-0/+21
|
* INSTALL: fixed suggested uninstall-commandhut2010-06-181-1/+1
|
* INSTALL: changed logname from uninstall_info to install_log.txthut2010-06-182-4/+4
|
* Merge branch 'setup2'hut2010-06-184-84/+67
|\
| * Removed built-in support for uninstalling.hut2010-06-182-13/+10
| | | | | | | | | | | | Since distutils (setup.py) is used and distutils doesn't support uninstalling, I shouldn't implement my own half-assed, potentially dangerous uninstall script either.
| * added scripts/ranger (simple link to ranger.py)hut2010-06-181-0/+1
| |
| * Rewrote INSTALL and "make (un)install"hut2010-06-182-36/+26
| |
| * Makefile: removed functions which are now handled by setup.pyhut2010-06-181-51/+4
| |
| * added setup.py drafthut2010-06-181-0/+42
| |
* | changed version numbering schemehut2010-06-181-4/+3
| |
* | Don't write bytecode with --clean switchhut2010-06-181-11/+15
| |
* | main: catch SystemExit and return the exit valuehut2010-06-182-2/+7
|/
* all_benchmarks: shortenedhut2010-06-181-9/+8
|
* core.runner: added "w" flag (wait for enter after process is done)hut2010-06-182-1/+19
|
* core.actions: fixed move_parent()hut2010-06-181-3/+2
|
* make snapshot: prefix ranger-$VERSION/ in archiveshut2010-06-141-1/+1
|
* make install: Fixed script for finding PYTHON_SITE_DESThut2010-06-141-2/+6
|
* new stable version v1.1.0hut2010-06-094-6/+6
|
* fsobject.file: blacklist /proc/kcore for previewinghut2010-06-092-2/+4
|
* updated manpagehut2010-06-091-5/+4
|
* renamed "--fail-if-run" to the more accurate "--fail-unless-cd"hut2010-06-094-11/+17
| | | | The old name, --fail-if-run, is still valid and working.
* Reverted hashbang for ranger.py.hut2010-06-091-1/+1
| | | | | It causes an error here: /usr/bin/env: python -O: No such file or directory
* widgets.console: fixed history in clean modehut2010-06-091-1/+5
|
* minor changeshut2010-06-092-2/+3
|
* updated pydochut2010-06-0918-57/+113
|
* all_benchmarks.py: fix + cleanuphut2010-06-091-40/+35
|
/span> curses.curs_set(1) self.mode = mode self.__class__ = cls self.history = self.histories[DEFAULT_HISTORY] self.init() self.tab_deque = None self.focused = True self.visible = True self.line = string self.pos = len(string) self.history.add('') return True def close(self): curses.curs_set(self.last_cursor_mode) self.add_to_history() self.clear() self.__class__ = Console self.focused = False self.visible = False if hasattr(self, 'on_close'): self.on_close() def clear(self): self.pos = 0 self.line = '' def press(self, key): from curses.ascii import ctrl, ESC try: cmd = self.commandlist[self.env.keybuffer.tuple_with_numbers()] except KeyError: self.env.key_clear() return if cmd == self.commandlist.dummy_object: return cmd.execute(self) self.env.key_clear() def type_key(self, key): self.tab_deque = None if isinstance(key, int): key = chr(key) if self.pos == len(self.line): self.line += key else: self.line = self.line[:self.pos] + key + self.line[self.pos:] self.pos += len(key) self.on_line_change() def history_move(self, n): from ranger.container.history import HistoryEmptyException try: current = self.history.current() except HistoryEmptyException: pass else: if self.line != current and self.line != self.history.top(): self.history.modify(self.line) self.history.move(n) current = self.history.current() if self.line != current: self.line = self.history.current() self.pos = len(self.line) def add_to_history(self): self.history.fast_forward() self.history.modify(self.line) def move(self, relative = 0, absolute = None): if absolute is not None: if absolute < 0: self.pos = len(self.line) + 1 + absolute else: self.pos = absolute self.pos = min(max(0, self.pos + relative), len(self.line)) def delete_rest(self, direction): self.tab_deque = None if direction > 0: self.copy = self.line[self.pos:] self.line = self.line[:self.pos] else: self.copy = self.line[:self.pos] self.line = self.line[self.pos:] self.pos = 0 self.on_line_change() def paste(self): if self.pos == len(self.line): self.line += self.copy else: self.line = self.line[:self.pos] + self.copy + self.line[self.pos:] self.pos += len(self.copy) self.on_line_change() def delete_word(self): self.tab_deque = None try: i = self.line.rindex(' ', 0, self.pos - 1) + 1 self.line = self.line[:i] + self.line[self.pos:] self.pos = len(self.line) except ValueError: self.line = '' self.pos = 0 self.on_line_change() def delete(self, mod): self.tab_deque = None if mod == -1 and len(self.line) == 0: self.close() pos = self.pos + mod self.line = self.line[0:pos] + self.line[pos+1:] self.move(relative = mod) self.on_line_change() def execute(self): self.tab_deque = None self.close() def tab(self): pass def on_line_change(self): pass class CommandConsole(Console): prompt = ':' def execute(self, cmd=None): if cmd is None: cmd = self._get_cmd() if cmd: cmd.execute() Console.execute(self) def tab(self, n=1): if self.tab_deque is None: tab_result = self._get_tab() if isinstance(tab_result, str): self.line = tab_result self.pos = len(tab_result) self.on_line_change() elif tab_result == None: pass elif hasattr(tab_result, '__iter__'): self.tab_deque = deque(tab_result) self.tab_deque.appendleft(self.line) if self.tab_deque is not None: self.tab_deque.rotate(-n) self.line = self.tab_deque[0] self.pos = len(self.line) self.on_line_change() def _get_cmd(self): try: command_name = self.line.split()[0] except: return None try: command_class = commands.by_name[command_name] except KeyError: return None return command_class(self.line, self.mode) def _get_tab(self): cmd = self._get_cmd() if cmd: return cmd.tab() else: return None class QuickCommandConsole(CommandConsole): """ The QuickCommandConsole is essentially the same as the CommandConsole, and includes one additional feature: After each letter you type, it checks whether the command as it stands there could be executed in a meaningful way, and if it does, run it right away. Example: >cd .. As you type the last dot, The console will recognize what you mean and enter the parent directory saving you the time of pressing enter. """ prompt = '>' def on_line_change(self): cmd = self._get_cmd() if cmd and cmd.quick_open(): self.execute(cmd) class SearchConsole(Console): prompt = '/' def init(self): self.history = self.histories[SEARCH_HISTORY] def execute(self): import re if self.fm.env.pwd: regexp = re.compile(self.line, re.L | re.U | re.I) self.fm.env.last_search = regexp if self.fm.env.pwd.search(regexp): self.fm.env.cf = self.fm.env.pwd.pointed_file Console.execute(self) class OpenConsole(Console): """ The OpenConsole allows you to execute shell commands: !vim * will run vim and open all files in the directory. There is a special syntax for more control: !d! mplayer will run mplayer with flags (d means detached) !@ mplayer will open the selected files with mplayer those two can be combinated: !d!@mplayer will open the selection with a detached mplayer For a list of other flags than "d", look at the documentation of ranger.applications. """ prompt = '!' def init(self): self.history = self.histories[OPEN_HISTORY] def execute(self): from ranger.applications import run from subprocess import STDOUT, PIPE command, flags = self._parse() if command: run(command, flags=flags, fm=self.fm, mode=0, shell=True, stdin=None, apps=self.fm.apps, stderr=STDOUT) Console.execute(self) def _parse(self): if '!' in self.line: flags, cmd = self.line.split('!', 1) else: flags, cmd = '', self.line add_selection = False if cmd.startswith('@'): cmd = cmd[1:] add_selection = True elif flags.startswith('@'): flags = flags[1:] add_selection = True if add_selection: cmd += ' ' + ' '.join(tuple(map(self._shellify, self.env.get_selection()))) return (cmd, flags) def _shellify(self, string): return "'" + str(string).replace("'","'\"'\"'") + "'" class QuickOpenConsole(Console): """ The QuickOpenConsole allows you to open files with pre-defined programs and modes very quickly. By adding flags to the command, you can specify precisely how the program is run, ie. the d-flag will run it detached from the filemanager. """ prompt = 'open with: ' def init(self): self.history = self.histories[QUICKOPEN_HISTORY] def execute(self): split = self.line.split() app, flags, mode = self._get_app_flags_mode() self.fm.execute_file( files = [self.env.cf], app = app, flags = flags, mode = mode ) Console.execute(self) def _get_app_flags_mode(self): """ Extracts the application, flags and mode from a string entered into the "openwith_quick" console. """ # examples: # "mplayer d 1" => ("mplayer", "d", 1) # "aunpack 4" => ("aunpack", "", 4) # "p" => ("", "p", 0) # "" => None app = '' flags = '' mode = 0 split = self.line.split() if len(split) == 0: pass elif len(split) == 1: part = split[0] if self._is_app(part): app = part elif self._is_flags(part): flags = part elif self._is_mode(part): mode = part elif len(split) == 2: part0 = split[0] part1 = split[1] if self._is_app(part0): app = part0 if self._is_flags(part1): flags = part1 elif self._is_mode(part1): mode = part1 elif self._is_flags(part0): flags = part0 if self._is_mode(part1): mode = part1 elif self._is_mode(part0): mode = part0 if self._is_flags(part1): flags = part1 elif len(split) >= 3: part0 = split[0] part1 = split[1] part2 = split[2] if self._is_app(part0): app = part0 if self._is_flags(part1): flags = part1 if self._is_mode(part2): mode = part2 elif self._is_mode(part1): mode = part1 if self._is_flags(part2): flags = part2 elif self._is_flags(part0): flags = part0 if self._is_mode(part1): mode = part1 elif self._is_mode(part0): mode = part0 if self._is_flags(part1): flags = part1 return app, flags, int(mode) def _is_app(self, arg): return self.fm.apps.has(arg) def _is_flags(self, arg): from ranger.applications import ALLOWED_FLAGS return all(x in ALLOWED_FLAGS for x in arg) def _is_mode(self, arg): return all(x in '0123456789' for x in arg)