Further cleanup
This commit is contained in:
parent
479c8e56b4
commit
f1c3bc89ec
@ -27,6 +27,7 @@ from PyQt5.QtCore import pyqtSlot, QUrl, QObject
|
|||||||
|
|
||||||
from qutebrowser.config import config, configexc
|
from qutebrowser.config import config, configexc
|
||||||
from qutebrowser.commands import cmdexc, cmdutils
|
from qutebrowser.commands import cmdexc, cmdutils
|
||||||
|
from qutebrowser.keyinput import modeman
|
||||||
from qutebrowser.utils import message, objreg, qtutils, usertypes, utils
|
from qutebrowser.utils import message, objreg, qtutils, usertypes, utils
|
||||||
from qutebrowser.misc import split
|
from qutebrowser.misc import split
|
||||||
|
|
||||||
@ -262,8 +263,7 @@ class CommandRunner(QObject):
|
|||||||
record_last_command = True
|
record_last_command = True
|
||||||
record_macro = True
|
record_macro = True
|
||||||
|
|
||||||
mode_manager = objreg.get('mode-manager', scope='window',
|
mode_manager = modeman.instance(self._win_id)
|
||||||
window=self._win_id)
|
|
||||||
cur_mode = mode_manager.mode
|
cur_mode = mode_manager.mode
|
||||||
|
|
||||||
for result in self.parse_all(text):
|
for result in self.parse_all(text):
|
||||||
@ -285,7 +285,7 @@ class CommandRunner(QObject):
|
|||||||
|
|
||||||
if record_macro and cur_mode == usertypes.KeyMode.normal:
|
if record_macro and cur_mode == usertypes.KeyMode.normal:
|
||||||
macro_recorder = objreg.get('macro-recorder')
|
macro_recorder = objreg.get('macro-recorder')
|
||||||
macro_recorder.record(text, count)
|
macro_recorder.record_command(text, count)
|
||||||
|
|
||||||
@pyqtSlot(str, int)
|
@pyqtSlot(str, int)
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
|
@ -43,7 +43,6 @@ class MacroRecorder:
|
|||||||
|
|
||||||
@cmdutils.register(instance='macro-recorder', name='record-macro')
|
@cmdutils.register(instance='macro-recorder', name='record-macro')
|
||||||
@cmdutils.argument('win_id', win_id=True)
|
@cmdutils.argument('win_id', win_id=True)
|
||||||
@cmdutils.argument('register')
|
|
||||||
def record_macro_command(self, win_id, register=None):
|
def record_macro_command(self, win_id, register=None):
|
||||||
"""Start or stop recording a macro.
|
"""Start or stop recording a macro.
|
||||||
|
|
||||||
@ -70,7 +69,6 @@ class MacroRecorder:
|
|||||||
@cmdutils.register(instance='macro-recorder', name='run-macro')
|
@cmdutils.register(instance='macro-recorder', name='run-macro')
|
||||||
@cmdutils.argument('win_id', win_id=True)
|
@cmdutils.argument('win_id', win_id=True)
|
||||||
@cmdutils.argument('count', count=True)
|
@cmdutils.argument('count', count=True)
|
||||||
@cmdutils.argument('register')
|
|
||||||
def run_macro_command(self, win_id, count=1, register=None):
|
def run_macro_command(self, win_id, count=1, register=None):
|
||||||
"""Run a recorded macro.
|
"""Run a recorded macro.
|
||||||
|
|
||||||
@ -95,7 +93,7 @@ class MacroRecorder:
|
|||||||
for cmd in self._macros[register]:
|
for cmd in self._macros[register]:
|
||||||
commandrunner.run_safely(*cmd)
|
commandrunner.run_safely(*cmd)
|
||||||
|
|
||||||
def record(self, text, count):
|
def record_command(self, text, count):
|
||||||
"""Record a command if a macro is being recorded."""
|
"""Record a command if a macro is being recorded."""
|
||||||
if self._recording_macro is not None:
|
if self._recording_macro is not None:
|
||||||
self._macros[self._recording_macro].append((text, count))
|
self._macros[self._recording_macro].append((text, count))
|
||||||
|
Loading…
Reference in New Issue
Block a user