Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text_demo 'Text Wrap' doesn't seem to work #29

Open
wilsonk opened this issue May 25, 2022 · 1 comment
Open

Text_demo 'Text Wrap' doesn't seem to work #29

wilsonk opened this issue May 25, 2022 · 1 comment

Comments

@wilsonk
Copy link

wilsonk commented May 25, 2022

Perhaps this is just on my machine (Arch linux distro), but the 'Text Wrap' toggle doesn't seem to actually wrap the example sentences in the demo window. The scroll bar across the bottom of the editor window appears if you make the font size larger but the sentence doesn't wrap.

There is also no wrap if you just start typing on application startup and type off the edge of the editor window.

@fubark
Copy link
Owner

fubark commented May 25, 2022

Text wrapping is not implemented for the TextEditor widget yet. It does however work for the Text widget. Adding this feature to the TextEditor would involve additional computing for line positions so that the caret, mouse, and scrollview remains correct. The current logic for text layout is here for anyone interested:

pub fn textLayout(self: *Self, font_gid: FontGroupId, size: f32, str: []const u8, preferred_width: f32, buf: *TextLayout) void {

Since the TextEditor has a buffer for each line, the first version would probably need a TextLayout for each line.
In the meantime, I'll update the demo with a todo item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants