summaryrefslogtreecommitdiff
path: root/scene/gui/rich_text_label.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-10-19 18:48:34 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-10-19 18:48:34 -0300
commit2b12a8109dda1f47f9b75a5de91d7d00c1f25869 (patch)
tree3f3775c304e76ea2776d336c9a471d99359872c0 /scene/gui/rich_text_label.cpp
parent5d86a25f4d04b21559f0d4edbd4e70dc01ea6685 (diff)
parent0a02c28b2be8e8271d5f3ffb95a4b09f91c3bd32 (diff)
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'scene/gui/rich_text_label.cpp')
-rw-r--r--scene/gui/rich_text_label.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 7a607786ee..ef6a2ba6aa 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -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;
}