Record mode for :repeat-command before executing

This commit is contained in:
Jan Verbeek 2016-07-13 15:24:45 +02:00
parent cafe7181c7
commit 13cbdbb8bd
2 changed files with 18 additions and 5 deletions

View File

@ -275,6 +275,10 @@ class CommandRunner(QObject):
count: The count to pass to the command.
"""
for result in self.parse_all(text):
mode_manager = objreg.get('mode-manager', scope='window',
window=self._win_id)
cur_mode = mode_manager.mode
args = replace_variables(self._win_id, result.args)
if count is not None:
if result.count is not None:
@ -286,11 +290,8 @@ class CommandRunner(QObject):
else:
result.cmd.run(self._win_id, args)
mode_manager = objreg.get('mode-manager', scope='window',
window=self._win_id)
if result.cmdline[0] not in ['leave-mode', 'command-accept',
'repeat-command']:
last_command[mode_manager.mode] = (
if result.cmdline[0] != 'repeat-command':
last_command[cur_mode] = (
self._parse_count(text)[1],
count if count is not None else result.count)

View File

@ -490,3 +490,15 @@ Feature: Various utility commands.
And I run :repeat-command with count 2
Then the page should not be scrolled
And the error "prompt-accept: This command is only allowed in prompt/yesno mode." should be shown
Scenario: :repeat-command with mode-switching command
Given I open data/hints/link_blank.html
And I run :tab-only
When I run :hint
And I run :leave-mode
And I run :repeat-command
And I run :follow-hint a
And I wait until data/hello.txt is loaded
Then the following tabs should be open:
- data/hints/link_blank.html
- data/hello.txt (active)