“Today while running an apt full-upgrade I asked myself how apt does this nice progress bar stuck at the bottom line while still writing scrolling text.”
The trick is a VT100 scroll region, a cursor save and a cursor restore. A few escape codes older than most of the people using them. No ncurses and no TUI framework. The terminal already knew how to do this, and almost nobody reads the manual.