Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scene/gui/rich_text_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ float RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Ref<Font
l.text_buf->tab_align(tab_stops);
} else if (tab_size > 0) { // Align inline tabs.
Vector<float> tabs;
tabs.push_back(tab_size * p_base_font->get_char_size(' ', p_base_font_size).width);
tabs.push_back(MAX(1, tab_size * (p_base_font->get_char_size(' ', p_base_font_size).width + p_base_font->get_spacing(TextServer::SPACING_SPACE))));
l.text_buf->tab_align(tabs);
}

Expand Down Expand Up @@ -523,7 +523,7 @@ float RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
l.text_buf->tab_align(tab_stops);
} else if (tab_size > 0) { // Align inline tabs.
Vector<float> tabs;
tabs.push_back(tab_size * p_base_font->get_char_size(' ', p_base_font_size).width);
tabs.push_back(MAX(1, tab_size * (p_base_font->get_char_size(' ', p_base_font_size).width + p_base_font->get_spacing(TextServer::SPACING_SPACE))));
l.text_buf->tab_align(tabs);
}

Expand Down Expand Up @@ -1819,12 +1819,12 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
font_size = font_size_it->font_size;
}
if (rtl) {
stop += tab_size * font->get_char_size(' ', font_size).width;
stop += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)));
if (stop > p_click.x) {
break;
}
} else {
stop -= tab_size * font->get_char_size(' ', font_size).width;
stop -= MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)));
if (stop < p_click.x) {
break;
}
Expand Down Expand Up @@ -3271,7 +3271,7 @@ int RichTextLabel::_find_margin(Item *p_item, const Ref<Font> &p_base_font, int
if (font_size_it && font_size_it->font_size > 0) {
font_size = font_size_it->font_size;
}
margin += tab_size * font->get_char_size(' ', font_size).width;
margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)));

} else if (item->type == ITEM_LIST) {
Ref<Font> font = p_base_font;
Expand All @@ -3290,7 +3290,7 @@ int RichTextLabel::_find_margin(Item *p_item, const Ref<Font> &p_base_font, int
if (font_size_it && font_size_it->font_size > 0) {
font_size = font_size_it->font_size;
}
margin += tab_size * font->get_char_size(' ', font_size).width;
margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)));
}

item = item->parent;
Expand Down
6 changes: 3 additions & 3 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
// Apply tab align.
if (tab_size > 0) {
Vector<float> tabs;
tabs.push_back(font->get_char_size(' ', font_size).width * tab_size);
tabs.push_back(MAX(1, (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)) * tab_size));
text_line.data_buf->tab_align(tabs);
}

Expand Down Expand Up @@ -394,7 +394,7 @@ void TextEdit::Text::invalidate_all_lines() {
if (tab_size_dirty) {
if (tab_size > 0) {
Vector<float> tabs;
tabs.push_back(font->get_char_size(' ', font_size).width * tab_size);
tabs.push_back(MAX(1, (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)) * tab_size));
text[i].data_buf->tab_align(tabs);
}
}
Expand Down Expand Up @@ -3350,7 +3350,7 @@ void TextEdit::_update_placeholder() {

if (get_tab_size() > 0) {
Vector<float> tabs;
tabs.push_back(theme_cache.font->get_char_size(' ', theme_cache.font_size).width * get_tab_size());
tabs.push_back(MAX(1, (theme_cache.font->get_char_size(' ', theme_cache.font_size).width + theme_cache.font->get_spacing(TextServer::SPACING_SPACE)) * get_tab_size()));
placeholder_data_buf->tab_align(tabs);
}

Expand Down
Loading