From 5624c4409b312596acf71b571789d42dd311b837 Mon Sep 17 00:00:00 2001 From: sydist <81040138+sydist@users.noreply.github.com> Date: Tue, 26 May 2026 01:19:54 +0200 Subject: [PATCH] Fix RichTextLabel tab_size 0 causing 1px indent on lists and indents --- scene/gui/rich_text_label.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 3eae28b750..b5acb731a0 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -3638,7 +3638,9 @@ int RichTextLabel::_find_margin(Item *p_item, const Ref &p_base_font, int if (font_size_it && font_size_it->font_size > 0) { font_size = font_size_it->font_size; } - margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE))); + if (tab_size > 0) { + 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 = p_base_font; @@ -3657,7 +3659,9 @@ int RichTextLabel::_find_margin(Item *p_item, const Ref &p_base_font, int if (font_size_it && font_size_it->font_size > 0) { font_size = font_size_it->font_size; } - margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE))); + if (tab_size > 0) { + margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE))); + } } item = item->parent;