Skip to content

Commit 845ddb4

Browse files
committed
Merge pull request godotengine#102597 from kitbdev/fix-te-line-guideline-pos
Fix CodeEdit line length guideline zoomed position
2 parents cc678ec + 6a75a89 commit 845ddb4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scene/gui/code_edit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ void CodeEdit::_notification(int p_what) {
7878
if (line_length_guideline_columns.size() > 0) {
7979
const int xmargin_beg = theme_cache.style_normal->get_margin(SIDE_LEFT) + get_total_gutter_width();
8080
const int xmargin_end = size.width - theme_cache.style_normal->get_margin(SIDE_RIGHT) - (is_drawing_minimap() ? get_minimap_width() : 0);
81-
const float char_size = theme_cache.font->get_char_size('0', theme_cache.font_size).width;
8281

8382
for (int i = 0; i < line_length_guideline_columns.size(); i++) {
84-
const int xoffset = xmargin_beg + char_size * (int)line_length_guideline_columns[i] - get_h_scroll();
83+
const int column_pos = theme_cache.font->get_string_size(String("0").repeat((int)line_length_guideline_columns[i]), HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size).x;
84+
const int xoffset = xmargin_beg + column_pos - get_h_scroll();
8585
if (xoffset > xmargin_beg && xoffset < xmargin_end) {
8686
Color guideline_color = (i == 0) ? theme_cache.line_length_guideline_color : theme_cache.line_length_guideline_color * Color(1, 1, 1, 0.5);
8787
if (rtl) {

0 commit comments

Comments
 (0)