bczsalba / pytermgui

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
https://ptg.bczsalba.com
MIT License
2.21k stars 54 forks source link

[REQUEST] Consider implicitly including terminal coordinate system origin in cursor movements #60

Closed bczsalba closed 1 year ago

bczsalba commented 2 years ago

Is your feature request related to a problem? Please describe. When using any of the cursor-moving API (such as cursor_at, terminal.print(..., pos=...) and others) the user has to manually include the terminal origin to get the desired result. This could, and should just be done implicitly by the library.

Describe the solution you'd like All of these methods should just include the origin by default. It would be ideal for them all to call a central function that does it this way, which would perfectly coincide with my desires to separate ansi_interface functionality into its own unit, including a class and instance for the terminal's cursor. This could then just be called with a position (such as ptg.cursor.move(pos)), and that action would just include the origin.

Additional context s/o to #55 and #53 for exposing this issue, both started by the now very important library tester @leftbones.

bczsalba commented 1 year ago

Now the terminal's write method includes the origin, so this issue is practically fixed. Including it in other places is messy, since move_cursor's module (ansi_interface) doesn't have access to the terminal's origin.