Repository navigation
Fix leading-zero trimming in IntEdit with a bytes caption - #1525
Merged
penguinolog merged 1 commit intoOct 28, 2026
Merged
Conversation
Signed-off-by: Charan Rathore <[email protected]>
penguinolog
approved these changes
Oct 28, 2026
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.
Checklist
Description
IntEdit accepts bytes captions, but its zero-trimming helper compares a bytes slice with the string '0'. Typing 7 into an initial zero therefore leaves b'07' instead of b'7'. Moving the cursor past leading zeros has the same problem.
Choose the zero literal to match the text type. This keeps the string behavior and makes bytes text follow the same trimming rules. Tests cover typing, direct insertion, deletion, moving to the end, preserving a lone zero, cursor position, numeric value and postchange counts for string and bytes captions.
On master 3c3fa74, Linux and Python 3.12.15:
A separate macOS Python 3.12 run had 2,494 passed, 12 failed and 33 skipped. The same 12 Text rendering subcases fail on unchanged source. Its mypy runs report the same eight curses errors before and after the fix. Full tox, other Python versions, pylint and Pyrefly were not run locally.