@@ -762,7 +762,7 @@ void RichTextLabel::_set_table_size(ItemTable *p_table, int p_available_width) {
762762
763763 float h = frame->lines [i].text_buf ->get_size ().y + (frame->lines [i].text_buf ->get_line_count () - 1 ) * theme_cache.line_separation ;
764764 if (i > 0 ) {
765- h += theme_cache.line_separation ;
765+ h += theme_cache.paragraph_separation ;
766766 }
767767 if (frame->min_size_over .y > 0 ) {
768768 h = MAX (h, frame->min_size_over .y );
@@ -771,7 +771,7 @@ void RichTextLabel::_set_table_size(ItemTable *p_table, int p_available_width) {
771771 h = MIN (h, frame->max_size_over .y );
772772 }
773773 yofs += h;
774- 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 ;
774+ 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 ;
775775
776776 frame->lines [i].offset += offset;
777777 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
15131513 // Do not apply to the last line to avoid cutting text.
15141514 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 ;
15151515 } else {
1516- 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 ;
1516+ 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 ;
15171517 }
15181518 }
15191519 float vbegin = 0 , vsep = 0 ;
@@ -1545,7 +1545,7 @@ void RichTextLabel::_find_click(ItemFrame *p_frame, const Point2i &p_click, Item
15451545 while (ofs.y < size.height && from_line < to_line) {
15461546 MutexLock lock (main->lines [from_line].text_buf ->get_mutex ());
15471547 _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);
1548- 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);
1548+ 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);
15491549 if (((r_click_item != nullptr ) && ((*r_click_item) != nullptr )) || ((r_click_frame != nullptr ) && ((*r_click_frame) != nullptr ))) {
15501550 if (r_outside != nullptr ) {
15511551 *r_outside = false ;
@@ -1762,7 +1762,11 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
17621762 return table_offy;
17631763 }
17641764
1765- off.y += TS->shaped_text_get_descent (rid) + theme_cache.line_separation + p_vsep;
1765+ if (line == l.text_buf ->get_line_count () - 1 ) {
1766+ off.y += TS->shaped_text_get_descent (rid) + theme_cache.paragraph_separation + p_vsep;
1767+ } else {
1768+ off.y += TS->shaped_text_get_descent (rid) + theme_cache.line_separation + p_vsep;
1769+ }
17661770 }
17671771
17681772 // Text line hit.
@@ -1891,7 +1895,7 @@ int RichTextLabel::_find_first_line(int p_from, int p_to, int p_vofs) const {
18911895}
18921896
18931897_FORCE_INLINE_ float RichTextLabel::_calculate_line_vertical_offset (const RichTextLabel::Line &line) const {
1894- return line.get_height (theme_cache.line_separation );
1898+ return line.get_height (theme_cache.line_separation , theme_cache. paragraph_separation );
18951899}
18961900
18971901void RichTextLabel::_update_theme_item_cache () {
@@ -2287,7 +2291,7 @@ void RichTextLabel::_notification(int p_what) {
22872291 // Do not apply to the last line to avoid cutting text.
22882292 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 ;
22892293 } else {
2290- 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 ;
2294+ 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 ;
22912295 }
22922296 }
22932297 float vbegin = 0 , vsep = 0 ;
@@ -2450,7 +2454,7 @@ void RichTextLabel::_notification(int p_what) {
24502454 // Do not apply to the last line to avoid cutting text.
24512455 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 ;
24522456 } else {
2453- 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 ;
2457+ 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 ;
24542458 }
24552459 }
24562460 float vbegin = 0 , vsep = 0 ;
@@ -2494,7 +2498,7 @@ void RichTextLabel::_notification(int p_what) {
24942498 if (drawn_lines > 0 ) {
24952499 visible_paragraph_count++;
24962500 }
2497- 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);
2501+ 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);
24982502 from_line++;
24992503 }
25002504 if (has_focus () && get_tree ()->is_accessibility_enabled ()) {
@@ -7129,7 +7133,7 @@ int RichTextLabel::get_content_height() const {
71297133 // Do not apply to the last line to avoid cutting text.
71307134 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 ;
71317135 } else {
7132- 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 ;
7136+ 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 ;
71337137 }
71347138 }
71357139 return total_height;
@@ -7448,6 +7452,7 @@ void RichTextLabel::_bind_methods() {
74487452 BIND_THEME_ITEM_EXT (Theme::DATA_TYPE_STYLEBOX, RichTextLabel, progress_fg_style, " fill" , " ProgressBar" );
74497453
74507454 BIND_THEME_ITEM (Theme::DATA_TYPE_CONSTANT, RichTextLabel, line_separation);
7455+ BIND_THEME_ITEM (Theme::DATA_TYPE_CONSTANT, RichTextLabel, paragraph_separation);
74517456
74527457 BIND_THEME_ITEM (Theme::DATA_TYPE_FONT, RichTextLabel, normal_font);
74537458 BIND_THEME_ITEM (Theme::DATA_TYPE_FONT_SIZE, RichTextLabel, normal_font_size);
0 commit comments