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 Editor's block_caret options when enabled has wrong offset #50245

Closed
nonunknown opened this issue Jul 7, 2021 · 1 comment · Fixed by #50609
Closed

Text Editor's block_caret options when enabled has wrong offset #50245

nonunknown opened this issue Jul 7, 2021 · 1 comment · Fixed by #50609

Comments

@nonunknown
Copy link
Contributor

Godot version

v4.0.dev.custom_build [cb4e421]

System information

manjaro Gnome 21, AMD R7 200 series, Intel i3 3.0 GHZ,8GB RAM

Issue description

When the user enables block_caret option, it has wrong offset:

image

over non-empty lines is fine:
image

over empty lines it has wrong offset:
image

Steps to reproduce

  • Click Editor
  • Editor Settings
  • Text Editor
  • Cursor
  • block_caret
  • Enable it!

Minimal reproduction project

N/a

@akien-mga akien-mga changed the title [Vulkan] Text Editor's block_caret options when enabled has wrong offset Text Editor's block_caret options when enabled has wrong offset Jul 7, 2021
@VedatGunel
Copy link
Contributor

Seems to be a regression from #41100. Insert mode has the same problem.

From what I understand, shaped_text_get_descent and shaped_text_get_ascent returns 0 for empty text, which causes the wrong positioning.

godot/scene/gui/text_edit.cpp

Lines 1419 to 1426 in 60add98

} else { // End of the line.
if (insert_mode) {
l_caret.position.y = TS->shaped_text_get_descent(rid);
l_caret.size.y = caret_width;
} else {
l_caret.position.y = -TS->shaped_text_get_ascent(rid);
l_caret.size.y = h;
}

cc @bruvzg

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

Successfully merging a pull request may close this issue.

3 participants