Set up the movement functions based on the terminal capabilities.
(self)
| 599 | os.write(self.output_fd, b"\x1b[?2004l") |
| 600 | |
| 601 | def __setup_movement(self): |
| 602 | """ |
| 603 | Set up the movement functions based on the terminal capabilities. |
| 604 | """ |
| 605 | if 0 and self._hpa: # hpa don't work in windows telnet :-( |
| 606 | self.__move_x = self.__move_x_hpa |
| 607 | elif self._cub and self._cuf: |
| 608 | self.__move_x = self.__move_x_cub_cuf |
| 609 | elif self._cub1 and self._cuf1: |
| 610 | self.__move_x = self.__move_x_cub1_cuf1 |
| 611 | else: |
| 612 | raise RuntimeError("insufficient terminal (horizontal)") |
| 613 | |
| 614 | if self._cuu and self._cud: |
| 615 | self.__move_y = self.__move_y_cuu_cud |
| 616 | elif self._cuu1 and self._cud1: |
| 617 | self.__move_y = self.__move_y_cuu1_cud1 |
| 618 | else: |
| 619 | raise RuntimeError("insufficient terminal (vertical)") |
| 620 | |
| 621 | if self._dch1: |
| 622 | self.dch1 = self._dch1 |
| 623 | elif self._dch: |
| 624 | self.dch1 = terminfo.tparm(self._dch, 1) |
| 625 | else: |
| 626 | self.dch1 = None |
| 627 | |
| 628 | if self._ich1: |
| 629 | self.ich1 = self._ich1 |
| 630 | elif self._ich: |
| 631 | self.ich1 = terminfo.tparm(self._ich, 1) |
| 632 | else: |
| 633 | self.ich1 = None |
| 634 | |
| 635 | self.__move = self.__move_short |
| 636 | |
| 637 | def __write_changed_line(self, y, oldline, newline, px_coord): |
| 638 | # this is frustrating; there's no reason to test (say) |