`cmd` is a tuple of "event_name" and "event", which in the current implementation is always just the "buffer" which happens to be a list of single-character strings.
(self, cmd: tuple[str, list[str]])
| 657 | self.dirty = False |
| 658 | |
| 659 | def do_cmd(self, cmd: tuple[str, list[str]]) -> None: |
| 660 | """`cmd` is a tuple of "event_name" and "event", which in the current |
| 661 | implementation is always just the "buffer" which happens to be a list |
| 662 | of single-character strings.""" |
| 663 | |
| 664 | trace("received command {cmd}", cmd=cmd) |
| 665 | if isinstance(cmd[0], str): |
| 666 | command_type = self.commands.get(cmd[0], commands.invalid_command) |
| 667 | elif isinstance(cmd[0], type): |
| 668 | command_type = cmd[0] |
| 669 | else: |
| 670 | return # nothing to do |
| 671 | |
| 672 | command = command_type(self, *cmd) # type: ignore[arg-type] |
| 673 | command.do() |
| 674 | |
| 675 | self.after_command(command) |
| 676 | |
| 677 | if self.dirty: |
| 678 | self.refresh() |
| 679 | else: |
| 680 | self.update_cursor() |
| 681 | |
| 682 | if not isinstance(cmd, commands.digit_arg): |
| 683 | self.last_command = command_type |
| 684 | |
| 685 | self.finished = bool(command.finish) |
| 686 | if self.finished: |
| 687 | self.console.finish() |
| 688 | self.finish() |
| 689 | |
| 690 | def run_hooks(self) -> None: |
| 691 | threading_hook = self.threading_hook |
no test coverage detected