#1998 Auto-size the macro-block command box to its content - #2001
Merged
TimothyLuke merged 2 commits intoAug 22, 2026
Conversation
The "Macro Name or Macro Commands" box was a fixed 5 rows, so a 7-8 line block always scrolled. FitMacroEditBoxToContent measures the rendered text height with a hidden FontString in the box's own font (wraps included; estimating rows x font size drifted by a row), clamps to 5..24 rows, ignores a stored trailing newline except while the author is typing on that last row, and dedupes on the resulting height. It runs once after the block body is assembled and on every text change. Because the box sits under explicit-height containers (macrolayout, macroFields, macroBody, sized for the old 108px box), the fit pushes the height delta up through every fixed-height ancestor before auto-height ones re-lay out -- otherwise the box grew but overlapped the Repeat Interval row below it. Fixes TimothyLuke#1998 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… spacing Drop MACRO_BOX_MIN_LINES to 3 so a short block stops reserving five rows. The minimum was doing double duty as the widget's build height, and that height is load-bearing: NativeUI's SetNumLines(n) is n * 16 + STYLE.frameContentTop (28), so five rows IS macrolayout's SetHeight(108), and the fit pushes the DELTA from that baseline up through the fixed-height ancestors. Lowering the shared constant would have built the box at 76 against a 108 container and left ~32px of dead space under every block, so the build height is now its own MACRO_BOX_BASE_LINES = 5 with the arithmetic written down at both sites. Two font-size gaps the smaller minimum exposes: - oneRow is measured from a single "X" and so carries no line spacing, but the row clamps multiplied it straight out. Real N-row text is N * oneRow + (N - 1) * spacing, so with a nonzero GetSpacing() the min clamp fell short of a true N rows and clipped the bottom one. - NativeUI clamps the inner editbox to 40px (updateEditBoxSize). Five rows always cleared it; three rows at a small chat font do not, and the last row would render outside the visible scroll area. The frame is never asked for less than that floor now. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JaKGoo9zcWMDowDLy4cAbX
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.
Fixes #1998
Change (1 file, Editor.lua)
The "Macro Name or Macro Commands" box was a fixed 5 rows.
FitMacroEditBoxToContentnow measures the rendered text height with a hidden FontString in the box's own font (wraps included — row×font-size estimates drifted by a row), clamps to 5..24 rows, ignores a stored trailing newline except while the author is typing on that last row (so Enter at the bottom still opens the new row), and dedupes on the resulting height. Runs once after the block body is assembled and on every text change.The box sits under explicit-height containers (
macrolayout,macroFields,macroBody— sized for the old 108px box), so the fit pushes the height delta up through every fixed-height ancestor before auto-height ones re-lay out; without that the box grew but overlapped the Repeat Interval row.Verified
In-game: exact row count, no spare row, block grows/shrinks live, no overlap.
luac -pclean.🤖 Generated with Claude Code