I'm pretty sure it still breaks in lots of terminal emulators, but it
works far better than what recent versions of the unicode_width crate
were doing.
In my kitty-based setup, I observed the following bug:
1. Run cove[1], a toss-based application, in a kitty tab
2. Exit cove
3. Start lazygit[2]
4. Stage some files and enter a commit message
5. Try to press enter and observe garbage appearing in the text box
The bug occurred reliably after running cove, but never occurred if cove
was not run in that tab.
This commit fixes the bug by making the suspend sequence undo the
unsuspend sequence's steps in reverse order.
I'm not sure if the input max size and the output max size should be
separate, and I'm not sure whether the min size should also have an
effect on the input. For now, this works well enough, but I may need to
adjust it in the future as I stumble across new edge cases.
This change was made because I was using Resize as a way to set the size
of widgets containing text that were rendered inside Predraw widgets.
After this change, setting a max_width but no max_height has the desired
effect of making the inner widgets perform word wrapping. The resulting
Predrawn is then as high as it needs to be to contain the wrapped text.
Previously, Predrawn would use its parent frame's size. Now, it uses the
size requested by the widget. Because of this, it no longer requires a
full &mut Frame, but only a &mut WidthDb.
To set a maximum size, the widget can be wrapped inside a Resize.
All builder-like functions are now named with_*. There is also now a way
to set each property imperatively with only a mutable reference.
The only widgets I haven't yet converted to this style are the Join*
widgets; they're a bit harder to figure out an appropriate API for.