Repository navigation
refactor(input, composer): apply the go fix modernizers - #1538
Merged
Merged
Conversation
Contributor
Binary size
The ceiling is 47000000 bytes for each target. Main's size is from main at c606b6b (https://github.com/Gaurav-Gosain/tuios/actions/runs/41818148802). State the size cost in the pull request body. CI fails only above the ceiling. |
historyMatches only reads m.hist, so the order and the indexes it returns stay the same.
go fix suggested it. isConfiguredKey returns the same answer and still stops at the first chord that matches. go fix also rewrote two copy-mode loops in copymode_visual.go with slices.Backward. I left them out: lastPrintedCell then grows past the inlining budget and the text grows by 283 bytes.
Gaurav-Gosain
force-pushed
the
refactor/input-composer-modern-loops
branch
from
November 4, 2026 11:02
d967294 to
50bb2d7
Compare
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.
Two go fix modernizers in internal/input and internal/composer, one commit per package. Behaviour stays the same and the binary does not grow.
Scope
isConfiguredKeytests the composed chords withslices.ContainsFunc. It still stops at the first chord that matches.historyMatcheswalksm.histnewest first withslices.Backward. The body only reads the slice.Left out on purpose
input/copymode_visual.gowithslices.Backward. With that formlastPrintedCellno longer inlines, and the text section grows by 283 bytes. Copy mode reads no faster for it, so I kept the index loops.learn/commands.go(reset) too. That body callsDeleteWindow, which shrinks the slice it walks, so I did not touch it.Verification
just check --changedpasses. Itsfixreport lists the two copy-mode loops above.go testpasses for internal/input and internal/composer.isConfiguredKeygrows by 26 bytes andhistoryMatchesshrinks by 22.-count 10, before and after on the same machine. I ran them on the first version of this branch, which also had the copy-mode loops. Key routing does not reach those loops. Allocations are the same in every one. Time is within noise exceptKeyPrefixChord, which went from 2.446 to 2.393 µs (p=0.000).The composer benchmarks (
Keystroke16KiB,FrameUnchanged) also hold their allocations, 292 and 0.