Fix Android text rendering crash - #13
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2241f3b9b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44ceb9744c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| SetWindowPos(window, NULL, 0, 0, width, height, | ||
| SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); |
There was a problem hiding this comment.
Avoid re-entrant refresh while resizing the native window
On the first native Windows build, this changes the initially frame-adjusted outer size to the raw 440x210 dimensions, synchronously producing WM_SIZE. The Windows refresh() path invokes build_screen before setting st.rendering = true, so its WM_SIZE handler re-enters refresh() while window_ready is still false because the assignment awaits this function's return. The nested build therefore repeats SetWindowPos, potentially recursing until stack overflow before the example is shown; set the readiness/reentrancy guard before resizing or configure the native window outside the build callback.
Useful? React with 👍 / 👎.
| size := math.min(13.0, math.max(height - 8.0, 1.0)) | ||
| return ButtonImageLayout{ | ||
| visible: true | ||
| image: rect(5, (height - size) / 2, size, size) |
There was a problem hiding this comment.
Keep compact images inside narrow buttons
For a compact image-and-title button narrower than 18 pixels, the image size depends only on height and remains fixed at x = 5; for example, a 10×24 button gets an image rectangle spanning x=5 through x=18. The renderer clips only to the ancestor, not the button itself, so the icon paints outside the button and can overlap an adjacent control. The positive-title-area guard added after the earlier review suppresses only the text; clamp the image to the available width or omit it when no image area remains.
Useful? React with 👍 / 👎.
Fixes #12.
Moves text-width measurement directly into the immediate renderer’s truncation loop, avoiding the callback invocation that crashes Android while preserving the binary-search ellipsis behavior.
Verification:
v fmt -verify ui/ui_immediate.c.v ui/ui_custom_test.vv test ui(blocked: installed V compiler and V standard library are out of sync;time.Locationmethods are reported as duplicate.)