Prechádzať zdrojové kódy

Merge pull request #64783 from bruvzg/fix_rtl_min_size

Fix RTL min. size not triggering text cache update.
Rémi Verschelde 3 rokov pred
rodič
commit
854eb58074
1 zmenil súbory, kde vykonal 8 pridanie a 0 odobranie
  1. 8 0
      scene/gui/rich_text_label.cpp

+ 8 - 0
scene/gui/rich_text_label.cpp

@@ -4328,6 +4328,8 @@ void RichTextLabel::append_text(const String &p_bbcode) {
 }
 }
 
 
 void RichTextLabel::scroll_to_paragraph(int p_paragraph) {
 void RichTextLabel::scroll_to_paragraph(int p_paragraph) {
+	_validate_line_caches();
+
 	if (p_paragraph <= 0) {
 	if (p_paragraph <= 0) {
 		vscroll->set_value(0);
 		vscroll->set_value(0);
 	} else if (p_paragraph >= main->first_invalid_line.load()) {
 	} else if (p_paragraph >= main->first_invalid_line.load()) {
@@ -4349,6 +4351,8 @@ int RichTextLabel::get_visible_paragraph_count() const {
 }
 }
 
 
 void RichTextLabel::scroll_to_line(int p_line) {
 void RichTextLabel::scroll_to_line(int p_line) {
+	_validate_line_caches();
+
 	if (p_line <= 0) {
 	if (p_line <= 0) {
 		vscroll->set_value(0);
 		vscroll->set_value(0);
 		return;
 		return;
@@ -4966,6 +4970,8 @@ void RichTextLabel::install_effect(const Variant effect) {
 }
 }
 
 
 int RichTextLabel::get_content_height() const {
 int RichTextLabel::get_content_height() const {
+	const_cast<RichTextLabel *>(this)->_validate_line_caches();
+
 	int total_height = 0;
 	int total_height = 0;
 	int to_line = main->first_invalid_line.load();
 	int to_line = main->first_invalid_line.load();
 	if (to_line) {
 	if (to_line) {
@@ -4976,6 +4982,8 @@ int RichTextLabel::get_content_height() const {
 }
 }
 
 
 int RichTextLabel::get_content_width() const {
 int RichTextLabel::get_content_width() const {
+	const_cast<RichTextLabel *>(this)->_validate_line_caches();
+
 	int total_width = 0;
 	int total_width = 0;
 	int to_line = main->first_invalid_line.load();
 	int to_line = main->first_invalid_line.load();
 	for (int i = 0; i < to_line; i++) {
 	for (int i = 0; i < to_line; i++) {