Fix integer underflow bug in section.rs#2
Open
philippeitis wants to merge 1 commit intoenricozb:mainfrom
Open
Conversation
Owner
|
Thanks for the PR! This looks safe to me, I'll probably remove the comment though. Please feel free to make PRs for any widgets you'd like to add! If they're general enough I'll merge them. I'll take a look at your UI as well, very interested in how you've implemented copy/paste. I have some ideas on how to do focusing, but haven't added any widgets yet. I'm imagining something like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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