pfalcon / picotui

Lightweight, pure-Python Text User Interface (TUI) widget toolkit with minimal dependencies. Dedicated to the Pycopy project.
https://github.com/pfalcon/pycopy
MIT License
811 stars 70 forks source link

Proper resizing support requires sufficiently deep codebase refactors #50

Open arcivanov opened 3 years ago

arcivanov commented 3 years ago

This is related to #48 and is demonstrated on top of #49.

After resize in the examples/example_screen_resize.py, the use of arrow controls produces artifacts with dialog components being confused about their locations relative to the dialog.

Example:

https://user-images.githubusercontent.com/5355666/106370071-d6e16400-6324-11eb-8fa3-8327cee0ab37.mp4

pfalcon commented 3 years ago

Thanks for taking care to record video.

Yes, "resizing" support is experimental, and pretty hacked-up for now. There're at least 2 issues:

  1. Resize handling happens via asynchronous signals, and that's problematic and not reliable. Needs to be reworked to just produce a suitable synchronous event instead, like everything else.
  2. As you noticed (and I now remember), drawing setup isn't actually designed with relative coordinates in mind, and needs to be refactored (which is potentially backward incompatible change).

Some time ago I started to look into p.1, which turned out to be a bit of rabit hole due to https://www.python.org/dev/peps/pep-0475/ . It waits in backlog so far.