|
@@ -762,7 +762,7 @@ void RichTextLabel::_set_table_size(ItemTable *p_table, int p_available_width) {
|
|
|
|
|
|
float h = frame->lines[i].text_buf->get_size().y + (frame->lines[i].text_buf->get_line_count() - 1) * theme_cache.line_separation;
|
|
|
if (i > 0) {
|
|
|
- h += theme_cache.line_separation;
|
|
|
+ h += theme_cache.paragraph_separation;
|
|
|
}
|
|
|
if (frame->min_size_over.y > 0) {
|
|
|
h = MAX(h, frame->min_size_over.y);
|
|
@@ -771,7 +771,7 @@ void RichTextLabel::_set_table_size(ItemTable *p_table, int p_available_width) {
|
|
|
h = MIN(h, frame->max_size_over.y);
|
|
|
}
|
|
|
yofs += h;
|
|
|
- prev_h = frame->lines[i].offset.y + frame->lines[i].text_buf->get_size().y + frame->lines[i].text_buf->get_line_count() * theme_cache.line_separation;
|
|
|
+ prev_h = frame->lines[i].offset.y + frame->lines[i].text_buf->get_size().y + (frame->lines[i].text_buf->get_line_count() - 1) * theme_cache.line_separation + theme_cache.paragraph_separation;
|
|
|
|
|
|
frame->lines[i].offset += offset;
|
|
|
row_baseline = MAX(row_baseline, frame->lines[i].text_buf->get_line_ascent(frame->lines[i].text_buf->get_line_count() - 1));
|
|
@@ -1513,7 +1513,7 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
|
|
|
// Do not apply to the last line to avoid cutting text.
|
|
|
total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + (main->lines[to_line - 1].text_buf->get_line_count() - 1) * theme_cache.line_separation;
|
|
|
} else {
|
|
|
- total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + main->lines[to_line - 1].text_buf->get_line_count() * theme_cache.line_separation;
|
|
|
+ total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + (main->lines[to_line - 1].text_buf->get_line_count() - 1) * theme_cache.line_separation + theme_cache.paragraph_separation;
|
|
|
}
|
|
|
}
|
|
|
float vbegin = 0, vsep = 0;
|
|
@@ -1545,7 +1545,7 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
|
|
|
while (ofs.y < size.height && from_line < to_line) {
|
|
|
MutexLock lock(main->lines[from_line].text_buf->get_mutex());
|
|
|
_find_click_in_line(p_frame, from_line, ofs, text_rect.size.x, vsep, p_click, r_click_frame, r_click_line, r_click_item, r_click_char, false, p_meta);
|
|
|
- ofs.y += main->lines[from_line].text_buf->get_size().y + main->lines[from_line].text_buf->get_line_count() * (theme_cache.line_separation + vsep);
|
|
|
+ ofs.y += main->lines[from_line].text_buf->get_size().y + (main->lines[from_line].text_buf->get_line_count() - 1) * (theme_cache.line_separation + vsep) + (theme_cache.paragraph_separation + vsep);
|
|
|
if (((r_click_item != nullptr) && ((*r_click_item) != nullptr)) || ((r_click_frame != nullptr) && ((*r_click_frame) != nullptr))) {
|
|
|
if (r_outside != nullptr) {
|
|
|
*r_outside = false;
|
|
@@ -1762,7 +1762,11 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
|
|
|
return table_offy;
|
|
|
}
|
|
|
|
|
|
- off.y += TS->shaped_text_get_descent(rid) + theme_cache.line_separation + p_vsep;
|
|
|
+ if (line == l.text_buf->get_line_count() - 1) {
|
|
|
+ off.y += TS->shaped_text_get_descent(rid) + theme_cache.paragraph_separation + p_vsep;
|
|
|
+ } else {
|
|
|
+ off.y += TS->shaped_text_get_descent(rid) + theme_cache.line_separation + p_vsep;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Text line hit.
|
|
@@ -1891,7 +1895,7 @@ int RichTextLabel::_find_first_line(int p_from, int p_to, int p_vofs) const {
|
|
|
}
|
|
|
|
|
|
_FORCE_INLINE_ float RichTextLabel::_calculate_line_vertical_offset(const RichTextLabel::Line &line) const {
|
|
|
- return line.get_height(theme_cache.line_separation);
|
|
|
+ return line.get_height(theme_cache.line_separation, theme_cache.paragraph_separation);
|
|
|
}
|
|
|
|
|
|
void RichTextLabel::_update_theme_item_cache() {
|
|
@@ -2287,7 +2291,7 @@ void RichTextLabel::_notification(int p_what) {
|
|
|
// Do not apply to the last line to avoid cutting text.
|
|
|
total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + (main->lines[to_line - 1].text_buf->get_line_count() - 1) * theme_cache.line_separation;
|
|
|
} else {
|
|
|
- total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + main->lines[to_line - 1].text_buf->get_line_count() * theme_cache.line_separation;
|
|
|
+ total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + (main->lines[to_line - 1].text_buf->get_line_count() - 1) * theme_cache.line_separation + theme_cache.paragraph_separation;
|
|
|
}
|
|
|
}
|
|
|
float vbegin = 0, vsep = 0;
|
|
@@ -2450,7 +2454,7 @@ void RichTextLabel::_notification(int p_what) {
|
|
|
// Do not apply to the last line to avoid cutting text.
|
|
|
total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + (main->lines[to_line - 1].text_buf->get_line_count() - 1) * theme_cache.line_separation;
|
|
|
} else {
|
|
|
- total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + main->lines[to_line - 1].text_buf->get_line_count() * theme_cache.line_separation;
|
|
|
+ total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + (main->lines[to_line - 1].text_buf->get_line_count() - 1) * theme_cache.line_separation + theme_cache.paragraph_separation;
|
|
|
}
|
|
|
}
|
|
|
float vbegin = 0, vsep = 0;
|
|
@@ -2494,7 +2498,7 @@ void RichTextLabel::_notification(int p_what) {
|
|
|
if (drawn_lines > 0) {
|
|
|
visible_paragraph_count++;
|
|
|
}
|
|
|
- ofs.y += main->lines[from_line].text_buf->get_size().y + main->lines[from_line].text_buf->get_line_count() * (theme_cache.line_separation + vsep);
|
|
|
+ ofs.y += main->lines[from_line].text_buf->get_size().y + (main->lines[from_line].text_buf->get_line_count() - 1) * (theme_cache.line_separation + vsep) + (theme_cache.paragraph_separation + vsep);
|
|
|
from_line++;
|
|
|
}
|
|
|
if (has_focus() && get_tree()->is_accessibility_enabled()) {
|
|
@@ -7129,7 +7133,7 @@ int RichTextLabel::get_content_height() const {
|
|
|
// Do not apply to the last line to avoid cutting text.
|
|
|
total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + (main->lines[to_line - 1].text_buf->get_line_count() - 1) * theme_cache.line_separation;
|
|
|
} else {
|
|
|
- total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + main->lines[to_line - 1].text_buf->get_line_count() * theme_cache.line_separation;
|
|
|
+ total_height = main->lines[to_line - 1].offset.y + main->lines[to_line - 1].text_buf->get_size().y + (main->lines[to_line - 1].text_buf->get_line_count() - 1) * theme_cache.line_separation + theme_cache.paragraph_separation;
|
|
|
}
|
|
|
}
|
|
|
return total_height;
|
|
@@ -7448,6 +7452,7 @@ void RichTextLabel::_bind_methods() {
|
|
|
BIND_THEME_ITEM_EXT(Theme::DATA_TYPE_STYLEBOX, RichTextLabel, progress_fg_style, "fill", "ProgressBar");
|
|
|
|
|
|
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, RichTextLabel, line_separation);
|
|
|
+ BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, RichTextLabel, paragraph_separation);
|
|
|
|
|
|
BIND_THEME_ITEM(Theme::DATA_TYPE_FONT, RichTextLabel, normal_font);
|
|
|
BIND_THEME_ITEM(Theme::DATA_TYPE_FONT_SIZE, RichTextLabel, normal_font_size);
|