Fix integer underflow bug in section.rs #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This would cause watch.rs to crash when build using debug mode. Considering that integer underflow is a problem in release mode, I used saturating_sub / saturating_add to avoid this problem, and included a link to the relevant source code.
On an another note, I myself am also building a TUI for my own application, and have been flowing moving towards this exact style. I'd like to contribute a few of the widgets I've built - infinitely scrolling lists, text-widgets with selection, copy/paste/cut, backwards / forwards deletion. I've also implemented additional scroll features based on keyboard input.
I'd also be interested in a focus-grabbing system for widgets (so that all input goes by default to a text entry widget, for example, and commands "bubble" up the stack) - I've implemented a basic version of this, but a more powerful version would allow assigning a deeply nested widget focus by default.
All of this can be found here: https://github.com/philippeitis/bookworm/tree/master/bookworm-tui/src/ui/widgets