Fix Command.takes_count

Before, what this actually did was checking the .count argument of
a string (the *keys* in self._qute_args). Therefore, it always returned True as
soon as a command had any @cmdutils.argument decorator.
This commit is contained in:
Florian Bruhin 2018-11-30 16:23:34 +01:00
parent 979be017c3
commit bfa518896a

View File

@ -537,7 +537,10 @@ class Command:
def takes_count(self):
"""Return true iff this command can take a count argument."""
return any(arg.count for arg in self._qute_args)
count_values = [usertypes.CommandValue.count,
usertypes.CommandValue.count_tab]
return any(info.value in count_values
for info in self._qute_args.values())
def register(self):
"""Register this command in objects.commands."""