Open IAmRasputin opened 8 years ago
https://github.com/cpjreynolds/rustty/pull/23 would introduce a widget based API, which would generalize widgets like dialogs and buttons and allow stuff like re-sizing to be implemented as a generalized function for all widget types.
I do agree re-sizing to prevent a crash is probably a good idea though. The problem however is you no longer have a static UI, re-sizing the widgets will almost always cause conflicts between existing elements. Another option would be to lock the console , not allowing a the screen to be resized
Looks good, I'll check it out.
On second thought, I want to keep this open until your PR is accepted. But the point you made about no longer having a static UI is valid. I'll give it some deeper thought. Maybe having core::position::Size be two lambda expressions that resolve to usize?
Would it be possible (or even desirable) to have Dialogs change size based on the size of the terminal? For example, in the UI example, shrinking the terminal to be smaller than 60 by 10 crashes the program. It would be useful if it shrank the dialog accordingly.