MCPcopy Index your code
hub / github.com/RustPython/RustPython / __setup_movement

Method __setup_movement

Lib/_pyrepl/unix_console.py:582–616  ·  view source on GitHub ↗

Set up the movement functions based on the terminal capabilities.

(self)

Source from the content-addressed store, hash-verified

580 os.write(self.output_fd, b"\x1b[?2004l")
581
582 def __setup_movement(self):
583 """
584 Set up the movement functions based on the terminal capabilities.
585 """
586 if 0 and self._hpa: # hpa don't work in windows telnet :-(
587 self.__move_x = self.__move_x_hpa
588 elif self._cub and self._cuf:
589 self.__move_x = self.__move_x_cub_cuf
590 elif self._cub1 and self._cuf1:
591 self.__move_x = self.__move_x_cub1_cuf1
592 else:
593 raise RuntimeError("insufficient terminal (horizontal)")
594
595 if self._cuu and self._cud:
596 self.__move_y = self.__move_y_cuu_cud
597 elif self._cuu1 and self._cud1:
598 self.__move_y = self.__move_y_cuu1_cud1
599 else:
600 raise RuntimeError("insufficient terminal (vertical)")
601
602 if self._dch1:
603 self.dch1 = self._dch1
604 elif self._dch:
605 self.dch1 = curses.tparm(self._dch, 1)
606 else:
607 self.dch1 = None
608
609 if self._ich1:
610 self.ich1 = self._ich1
611 elif self._ich:
612 self.ich1 = curses.tparm(self._ich, 1)
613 else:
614 self.ich1 = None
615
616 self.__move = self.__move_short
617
618 def __write_changed_line(self, y, oldline, newline, px_coord):
619 # this is frustrating; there's no reason to test (say)

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected