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

LineEdit bug when removing text with align=right/center #27421

Closed
issork opened this issue Mar 26, 2019 · 9 comments · Fixed by #34043 or #86732
Closed

LineEdit bug when removing text with align=right/center #27421

issork opened this issue Mar 26, 2019 · 9 comments · Fixed by #34043 or #86732

Comments

@issork
Copy link
Contributor

issork commented Mar 26, 2019

Godot version:
3.1-stable

Issue description:
When removing text from a LineEdit that has its alignment set to "Center" or "Right" and contains more text than can be shown, the caret starts acting weird. This gif shows it:

As you can see, the text is not being aligned properly and too few characters are drawn. With alignment set to "Center", it behaves like alignment set to "Left", then suddenly jumps back to the correct alignment when only one character remains.

Steps to reproduce:
Delete text from a full LineEdit with "Align" set to "Center" or "Right" by pressing backspace.

Edit:
This is also happening with align set to "Center", the offset is wrong until theres only one remaining character.

@samH-FIT
Copy link
Contributor

samH-FIT commented Apr 2, 2019

Would this issue be stemming from line_edit.cpp? Or would it be coming from a more general file, like text_edit.cpp?

@issork
Copy link
Contributor Author

issork commented Apr 3, 2019

@samH-FIT This comes from LineEdit, TextEdit doesn't have alignment.

I'm assuming this is due to a wrong x offset in

x_ofs = MAX(style->get_margin(MARGIN_LEFT), int(size.width - style->get_margin(MARGIN_RIGHT) - (cached_text_width)));

Edit: Noticed centered alignment has similar issues, the text isn't aligned properly until theres only 1 remaining character.

@issork issork changed the title LineEdit bug when removing text with align=right LineEdit bug when removing text with align=right/center Apr 3, 2019
@akien-mga akien-mga added this to the 3.2 milestone Apr 3, 2019
@KoBeWi
Copy link
Member

KoBeWi commented Nov 29, 2019

I discovered that the bug comes from window_pos. It's not updated properly for non-left aligns.

@issork
Copy link
Contributor Author

issork commented Feb 23, 2020

This isn't completetly fixed yet, as seen in the video below.
The order of the columns is in text alignment order, so the right column has align=right on it for example.

https://drive.google.com/open?id=1Lw4bwEbsztbKUkn5h8hkB3f8nM1QqkOR

As you can see, when removing text, there are still not enough characters drawn for center/right alignment. There are no more than 20 characters drawn at any point, even when it gets to the chars with a smaller width, which would allow for more characters drawn.

Edit: Added project that I used.
LineEditTest.zip

@KoBeWi
Copy link
Member

KoBeWi commented Feb 23, 2020

I can confirm the above case in a920f97

@KoBeWi KoBeWi reopened this Feb 23, 2020
@FeralBytes
Copy link
Contributor

I still see this issue for right align and for place holder text centered in Godot 3.2.2-beta4 on Linux and Android.

@akien-mga akien-mga modified the milestones: 3.2, 3.3 Mar 17, 2021
@akien-mga
Copy link
Member

The issue from #27421 (comment) seems still reproducible in 3.4 RC 1. CC @bruvzg @timothyqiu who have also been working on text controls and alignment.

@akien-mga akien-mga modified the milestones: 3.3, 3.5 Oct 26, 2021
@timothyqiu
Copy link
Member

The left-aligned behavior also looks weird to me:
Peek 2021-10-27 14-55

Normally, the line edit should be filled with text until there is not enough text:
Peek 2021-10-27 14-58

I think this might be related to the wrong right/center align behavior.

@issork
Copy link
Contributor Author

issork commented Oct 27, 2021

@timothyqiu I have a seperate issue for that #27420 ^^

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