Further cleanup

This commit is contained in:
Jan Verbeek 2016-11-09 14:56:41 +01:00
parent 479c8e56b4
commit f1c3bc89ec
2 changed files with 4 additions and 6 deletions

View File

@ -27,6 +27,7 @@ from PyQt5.QtCore import pyqtSlot, QUrl, QObject
from qutebrowser.config import config, configexc
from qutebrowser.commands import cmdexc, cmdutils
from qutebrowser.keyinput import modeman
from qutebrowser.utils import message, objreg, qtutils, usertypes, utils
from qutebrowser.misc import split
@ -262,8 +263,7 @@ class CommandRunner(QObject):
record_last_command = True
record_macro = True
mode_manager = objreg.get('mode-manager', scope='window',
window=self._win_id)
mode_manager = modeman.instance(self._win_id)
cur_mode = mode_manager.mode
for result in self.parse_all(text):
@ -285,7 +285,7 @@ class CommandRunner(QObject):
if record_macro and cur_mode == usertypes.KeyMode.normal:
macro_recorder = objreg.get('macro-recorder')
macro_recorder.record(text, count)
macro_recorder.record_command(text, count)
@pyqtSlot(str, int)
@pyqtSlot(str)

View File

@ -43,7 +43,6 @@ class MacroRecorder:
@cmdutils.register(instance='macro-recorder', name='record-macro')
@cmdutils.argument('win_id', win_id=True)
@cmdutils.argument('register')
def record_macro_command(self, win_id, register=None):
"""Start or stop recording a macro.
@ -70,7 +69,6 @@ class MacroRecorder:
@cmdutils.register(instance='macro-recorder', name='run-macro')
@cmdutils.argument('win_id', win_id=True)
@cmdutils.argument('count', count=True)
@cmdutils.argument('register')
def run_macro_command(self, win_id, count=1, register=None):
"""Run a recorded macro.
@ -95,7 +93,7 @@ class MacroRecorder:
for cmd in self._macros[register]:
commandrunner.run_safely(*cmd)
def record(self, text, count):
def record_command(self, text, count):
"""Record a command if a macro is being recorded."""
if self._recording_macro is not None:
self._macros[self._recording_macro].append((text, count))