mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Include SPACING_SPACE
into tab stops calculation.
This commit is contained in:
parent
8b2739ee55
commit
2409956297
2 changed files with 9 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue