Fix word-wrap toggle: actually stop wrapping when disabled

The bottom-bar 'Wrap: On/Off' toggle flipped State.WordWrap and relabelled
itself, but the render path never read the flag: NewTextField hardcoded
WordWrap: true and drawWrappedText always shaped at the region width with
WrapHeuristically, so lines wrapped in both modes.

NewTextField now takes the wordWrap flag, TextField.Draw passes tf.WordWrap
to drawWrappedText, and with wrap disabled the shaper gets unlimited width
(MaxWidth = maxInt32, as in single-line layout) so over-long lines extend
past the region and are clipped instead of wrapping. EditorLayout passes
its existing wordWrap parameter through.
This commit is contained in:
gmp
2026-08-19 22:35:13 -04:00
parent d8b5bc704b
commit eb725ee781
3 changed files with 12 additions and 5 deletions
+1
View File
@@ -2106,6 +2106,7 @@ func EditorLayout(screenWidth, screenHeight ui.Dp, wordWrap bool) []ui.Element {
"editor_text",
visibleContent,
editorRegion,
wordWrap,
editorRegion.W,
visibleScrollOffset,
visibleCursorPos,