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

TextEdit.get_rect_at_line_column returns negative pos even though cursor is in viewable area of the control #81349

Closed
MJacred opened this issue Sep 5, 2023 · 0 comments · Fixed by #81354
Milestone

Comments

@MJacred
Copy link
Contributor

MJacred commented Sep 5, 2023

Godot version

3.5.2, 4.1.1

System information

Godot v3.5.2.stable and v4.1.1.stable - Ubuntu 20.04.6 LTS (Focal Fossa) - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 970 (nvidia; 525.125.06) - Intel(R) Core(TM) i7-10700KF CPU @ 3.80GHz (16 Threads)

Issue description

  • What does not work: accurately returning the x and y pixel positions of the active cursor in TextEdit
  • What did you expect: return position of cursor while it is inside of the viewable area of the control

Note: as get_pos_at_line_column calls get_rect_at_line_column, it is affected as well.

In Godot 3:
Always incorrect for last column.

In Godot 4:
Always incorrect if the line has only 0 or 1 characters.
And starting with second line when there's exactly 1 character.

Pinging @YuriSizov and @Paulb23, as they worked on the Godot 4 version.

Steps to reproduce

Read pixel rect/pos of cursor while cursor is in last column of line

Currently, the result in Godot 3.5.2 is:

textedit-bug.webm

Recorded while using get_pos_at_line_column, but MRP uses get_rect_at_line_column

In Godot 4.1.1:

textedit-bug_godot-4.webm

Minimal reproduction project

Godot 3.5.2

textedit-bug.tar.gz

for project migration to Godot 4, change line 24 to l.text = var_to_str(pos). Beware: terrible performance in Godot 4

@MJacred MJacred changed the title TextEdit.get_rect_at_line_column() returns negative pos even though cursor is in viewable area of the control TextEdit.get_rect_at_line_column returns negative pos even though cursor is in viewable area of the control Sep 5, 2023
@akien-mga akien-mga added this to the 4.2 milestone Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants