`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]])
| 694 | self.dirty = False |
| 695 | |
| 696 | def do_cmd(self, cmd: tuple[str, list[str]]) -> None: |
| 697 | """`cmd` is a tuple of "event_name" and "event", which in the current |
| 698 | implementation is always just the "buffer" which happens to be a list |
| 699 | of single-character strings.""" |
| 700 | |
| 701 | trace("received command {cmd}", cmd=cmd) |
| 702 | if isinstance(cmd[0], str): |
| 703 | command_type = self.commands.get(cmd[0], commands.invalid_command) |
| 704 | elif isinstance(cmd[0], type): |
| 705 | command_type = cmd[0] |
| 706 | else: |
| 707 | return # nothing to do |
| 708 | |
| 709 | command = command_type(self, *cmd) # type: ignore[arg-type] |
| 710 | command.do() |
| 711 | |
| 712 | self.after_command(command) |
| 713 | |
| 714 | if self.dirty: |
| 715 | self.refresh() |
| 716 | else: |
| 717 | self.update_cursor() |
| 718 | |
| 719 | if not isinstance(cmd, commands.digit_arg): |
| 720 | self.last_command = command_type |
| 721 | |
| 722 | self.finished = bool(command.finish) |
| 723 | if self.finished: |
| 724 | self.console.finish() |
| 725 | self.finish() |
| 726 | |
| 727 | def run_hooks(self) -> None: |
| 728 | threading_hook = self.threading_hook |
no test coverage detected