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 wrapping can fail and hide characters in code examples (TextEdit) #99

Open
duianto opened this issue Jan 4, 2022 · 8 comments
Open
Labels
bug Something isn't working as intended godot-engine This task likely requires making changes in the Godot engine wontfix This will not be worked on

Comments

@duianto
Copy link
Contributor

duianto commented Jan 4, 2022

Describe the bug
Code example, last letter hidden.

To Reproduce
Steps to reproduce the bug:

  1. Go to: 1. What Code is Like
    https://gdquest.github.io/learn-gdscript/#course/lesson-1-what-code-is-like/lesson.tres

  2. Scroll down to the code example

  3. See the missing letter n at the end of line 2:

    Vector2(0, 0), # position

smallest (default) text size, missing last letter

This is observed with the Text Size slider dragged to the left (default).

Expected behavior
The last letter on the line should be visible,
or the line should wrap to show the last word on the next line.

The word position does become wrapped,
when the Text Size slider is dragged to the middle.

middle text size, comment wrapped

Or to the right.

largest text size, comment wrapped

But the last word position also remains wrapped,
when the Text Size slider is dragged to the left, from the middle or the right.

smallest text size, after middle or large, comment wrapped

Reloading the page with the smallest Text Size.
Restores the initial behavior. Now the last letter n is missing again.
As observed in the first screenshot.

Information about your device (please complete the following information):

  • Operating System: Windows 10 21H1
  • Browser: Microsoft Edge 96.0.1054.62 (Official build) (64-bit)

Additional context
In this case, it only hides the last letter of a comment.
And the following lessons, might not be hiding any important characters.

But if/when the code examples are refactored/typo fixed, etc.,
then this issue might appear in the future.

@duianto duianto added the bug Something isn't working as intended label Jan 4, 2022
@NathanLovato NathanLovato self-assigned this Jan 5, 2022
@NathanLovato NathanLovato added this to the 0.2 milestone Jan 5, 2022
@NathanLovato
Copy link
Contributor

This seems like a Godot bug to me. It's also quite strange: it only happens on the web build, only with the smallest text size, and only upon first loading the page: reopening the lesson from the course outliner makes the text wrap as expected.

I think it's not something we can fix definitively on our end. We can only work around this, I think.

@duianto
Copy link
Contributor Author

duianto commented Jan 5, 2022

Here's an instance where the first lines colon,
or all but one close parentheses become hidden.

In lesson:
6. Your First Function Parameter
https://gdquest.github.io/learn-gdscript/#course/lesson-6-multiple-function-parameters/lesson.tres

Everything is visible before dragging the Size slider.

before_dragging_the_slider

Dragging the Size slider:

  • To a two-digit number.
    Hides the first lines ending : colon.

two-digits

  • To a three-digit number.
    Wraps the first line.
    And hides the close parentheses, at the end of the lines with the move_forward function calls.

three-digits

@NathanLovato NathanLovato added the help wanted Extra attention is needed label Jan 5, 2022
@NathanLovato NathanLovato removed their assignment Jan 5, 2022
@NathanLovato NathanLovato modified the milestones: 0.2, 0.3 Jan 26, 2022
@NathanLovato
Copy link
Contributor

I found the reason: changing the font size wasn't detected by the TextEdit node, so it didn't update the text wrapping. The added code forces the text wrapping to update.

@YuriSizov
Copy link
Contributor

I don't see any difference in behavior with or without 49540b8.

Given the example in Lesson 1:

  • Initially loaded smallest size is clipped.
  • If you resize to use medium size, it's not clipped.
  • If you resize back to the smallest, it's also no longer clipped.
  • If you resize to the biggest, it's still clipped no matter what.
  • If you load into the medium size, it's not clipped, the rest behave the same on resize.
  • If you load into the biggest size, it's no longer clipped, and every other size updates correctly on resize.

This is with or without that linked commit. No difference.

@YuriSizov YuriSizov reopened this Jan 31, 2022
@YuriSizov
Copy link
Contributor

I've removed the code introduced by the aforementioned commit, because I'm confident it doesn't so anything (there is a check in control.cpp to not propagate any notifications and signals if the size didn't actually change). The problem seems to be rooted in the TextEdit itself. Initially the wrapping is calculated correctly, but within a frame or so it gets invalidated, probably because it considers that the line doesn't reach the wrapping index, so it doesn't actually need to be wrapped.

Unfortunately, it's very hard to debug text rendering, so I'll have to put this on pause.

@NathanLovato NathanLovato removed this from the 0.4 milestone Feb 13, 2022
@NathanLovato NathanLovato changed the title Code example, last letter hidden Text wrapping can fail and hide characters in code examples (TextEdit) Feb 13, 2022
@NathanLovato NathanLovato added the godot-engine This task likely requires making changes in the Godot engine label Feb 20, 2022
@NathanLovato NathanLovato added wontfix This will not be worked on and removed help wanted Extra attention is needed labels Aug 21, 2022
@NathanLovato
Copy link
Contributor

Marked as wontfix for now, we'll wait for Godot 4 and its new text server to address this.

@Snailedlt
Copy link

Now that Godot 4 is out, will this be looked into again?

I'm getting the same issue with
Lesson 16: https://gdquest.github.io/learn-gdscript/#course/lesson-16-2d-vectors/lesson.tres
image

@NathanLovato
Copy link
Contributor

We're making a new app as a sequel to this one with web native technologies, that'll remove a good number of issues (selectable text, text to speech, accurate text wrapping, accessibility, easier translation support...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended godot-engine This task likely requires making changes in the Godot engine wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants