Correction to RichTextLabel Tabulation

Correct backtrack assignment to prevent excessive tabulation. Worth
noting that tabulation is treated differently in RichTextLabel because
of custom user-asignable tab variable which creates problems with
dynamic fonts specifically.

(cherry picked from commit 2000e110a9)
This commit is contained in:
Eoin O'Neill 2020-03-28 17:20:07 -07:00 committed by Rémi Verschelde
parent dd4569f15c
commit c18381119e
1 changed files with 2 additions and 1 deletions

View File

@ -576,13 +576,14 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
} else {
cw = drawer.draw_char(ci, p_ofs + Point2(align_ofs + pofs, y + lh - line_descent) + fx_offset, fx_char, c[i + 1], fx_color);
}
} else if (previously_visible) {
} else if (previously_visible && c[i] != '\t') {
backtrack += font->get_char_size(fx_char, c[i + 1]).x;
}
p_char_count++;
if (c[i] == '\t') {
cw = tab_size * font->get_char_size(' ').width;
backtrack = MAX(0, backtrack - cw);
}
ofs += cw;