mirror of
https://github.com/godotengine/godot.git
synced 2024-11-28 15:12:33 +00:00
Merge pull request #1899 from guilhermefelipecgs/fix_#1897
Fix for scroll_to_line and search functions, fix #1897
This commit is contained in:
commit
be0f7563fb
@ -1503,10 +1503,10 @@ Error RichTextLabel::append_bbcode(const String& p_bbcode) {
|
||||
|
||||
void RichTextLabel::scroll_to_line(int p_line) {
|
||||
|
||||
p_line -= 1;
|
||||
ERR_FAIL_INDEX(p_line,lines.size());
|
||||
_validate_line_caches();
|
||||
vscroll->set_val(lines[p_line].height_accum_cache);
|
||||
|
||||
vscroll->set_val(lines[p_line].height_accum_cache-lines[p_line].height_cache);
|
||||
|
||||
}
|
||||
|
||||
@ -1569,27 +1569,23 @@ bool RichTextLabel::search(const String& p_string,bool p_from_selection) {
|
||||
it=_get_next_item(it);
|
||||
}
|
||||
|
||||
if (!it)
|
||||
line=lines.size()-1;
|
||||
}
|
||||
|
||||
scroll_to_line(line-2);
|
||||
if (line > 1) {
|
||||
line-=1;
|
||||
}
|
||||
|
||||
scroll_to_line(line);
|
||||
|
||||
return true;
|
||||
}
|
||||
} else if (it->type==ITEM_NEWLINE) {
|
||||
|
||||
line=static_cast<ItemNewline*>(it)->line;
|
||||
}
|
||||
|
||||
|
||||
it=_get_next_item(it);
|
||||
charidx=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user