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)
| 790 | self.handle1(block=False) |
| 791 | |
| 792 | def readline(self, startup_hook: Callback | None = None) -> str: |
| 793 | """Read a line. The implementation of this method also shows |
| 794 | how to drive Reader if you want more control over the event |
| 795 | loop.""" |
| 796 | self.prepare() |
| 797 | try: |
| 798 | if startup_hook is not None: |
| 799 | startup_hook() |
| 800 | self.refresh() |
| 801 | while not self.finished: |
| 802 | self.handle1() |
| 803 | return self.get_unicode() |
| 804 | |
| 805 | finally: |
| 806 | self.restore() |
| 807 | |
| 808 | def bind(self, spec: KeySpec, command: CommandName) -> None: |
| 809 | self.keymap = self.keymap + ((spec, command),) |
no test coverage detected