fix(app): strike through tabs in form mode and prevent form layout jump#446
Merged
fix(app): strike through tabs in form mode and prevent form layout jump#446
Conversation
Inactive tabs were not struck through (TabLocked style) when a full-row form was open, only when in edit mode. Extract tabsLocked() to cover both modeEdit and modeForm. Multi-group forms (Incidents, Projects, etc.) jumped on open because huh's Form.Init() defers a tea.WindowSize() cmd. When it arrives one frame later the form recalculates group widths (from 80 to terminal width) and heights (to the max group), shifting the "enter next" indicator. Fix by eagerly sending a synthetic WindowSizeMsg in activateForm so dimensions are correct before the first render. Cache the Init cmd in pendingFormInit so formInitCmd() returns it once instead of re-calling Init(). closes #433 Co-Authored-By: Claude Opus 4.6 <[email protected]>
The previous approach sent a synthetic WindowSizeMsg to the form in activateForm, which triggered huh's height equalization -- padding all groups to the tallest group's height. This pushed the "enter next" indicator far below the last field on forms where the current group is shorter than the tallest (e.g. House: Basics has 6 fields vs Structure with 10). Fix by setting the form width via WithWidth before Init (so groups have correct terminal widths from the first frame) and blocking the deferred WindowSizeMsg in updateForm for all forms (not just the house form). This prevents both the width-induced layout jump and the unwanted height equalization. Co-Authored-By: Claude Opus 4.6 <[email protected]>
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.
Summary
TabLocked(struck-through) style when a full-row form is open, matching existing edit-mode behavior. ExtractedtabsLocked()method covering bothmodeEditandmodeForm.Form.Init()deferring atea.WindowSize()cmd that recalculated group widths/heights one frame late. Fix sends a syntheticWindowSizeMsgeagerly inactivateFormso dimensions are correct before the first render.formInitCmd()now returns a one-shot cached cmd fromactivateForminstead of re-callingInit()each time.Steps to reproduce
Tab strikethrough (before fix):
ato add a new item (opens full form)Form jump (before fix):
ato add a new incidentcloses #433
🤖 Generated with Claude Code