Read a line. The implementation of this method also shows how to drive Reader if you want more control over the event loop.
(self, startup_hook: Callback | None = None)
| 753 | self.handle1(block=False) |
| 754 | |
| 755 | def readline(self, startup_hook: Callback | None = None) -> str: |
| 756 | """Read a line. The implementation of this method also shows |
| 757 | how to drive Reader if you want more control over the event |
| 758 | loop.""" |
| 759 | self.prepare() |
| 760 | try: |
| 761 | if startup_hook is not None: |
| 762 | startup_hook() |
| 763 | self.refresh() |
| 764 | while not self.finished: |
| 765 | self.handle1() |
| 766 | return self.get_unicode() |
| 767 | |
| 768 | finally: |
| 769 | self.restore() |
| 770 | |
| 771 | def bind(self, spec: KeySpec, command: CommandName) -> None: |
| 772 | self.keymap = self.keymap + ((spec, command),) |
no test coverage detected