summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2014-12-10 01:56:13 +0100
committerhut <hut@lepus.uberspace.de>2014-12-10 02:01:07 +0100
commitd0414ecd2dde3a154e8ef71188de574916a92a1c (patch)
tree29a5716d0f65980c942591ddf0ca885902a9eee4
parent2cd8bc7768ab3bdb95a2bdf49565db96d75659c1 (diff)
downloadranger-d0414ecd2dde3a154e8ef71188de574916a92a1c.tar.gz
api.commands: Added attribute Command.quickly_executed
This is set to True if the command was executed by cmd.quick() returning
True on a line change.
-rw-r--r--ranger/api/commands.py2
-rw-r--r--ranger/gui/widgets/console.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 7f5fcf36..e00fe385 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -92,6 +92,7 @@ class Command(FileManagerAware):
         self.line = line
         self.args = line.split()
         self.quantifier = quantifier
+        self.quickly_executed = False
         try:
             self.firstpart = line[:line.rindex(' ') + 1]
         except ValueError:
@@ -407,6 +408,7 @@ class AliasCommand(Command):
     def _make_cmd(self):
         cmd_class = self.fm.commands.get_command(self._line.split()[0])
         cmd = cmd_class(self._line + ' ' + self.rest(1))
+        cmd.quickly_executed = self.quickly_executed
         cmd.quantifier = self.quantifier
         cmd.escape_macros_for_shell = self.escape_macros_for_shell
         cmd.resolve_macros = self.resolve_macros
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 8dd201e5..b2079d8d 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -359,7 +359,11 @@ class Console(Widget):
             return
 
         self.allow_close = True
-        self.fm.execute_console(self.line)
+        if cmd:
+            cmd.execute()
+        else:
+            self.fm.execute_console(self.line)
+
         if self.allow_close:
             self._close_command_prompt(trigger_cancel_function=False)
 
@@ -419,6 +423,7 @@ class Console(Widget):
         else:
             cmd = cls(self.line)
             if cmd and cmd.quick():
+                cmd.quickly_executed = True
                 self.execute(cmd)
 
     def ask(self, text, callback, choices=['y', 'n']):