diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-09-21 01:43:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-09-21 01:43:42 -0300 |
commit | 11a5ed508b1cbde61a4d9dd4f469e86e74667623 (patch) | |
tree | e4bc1926057d788aeeef3633930bb958eb976d3a /scene/gui | |
parent | c5b905fca82f1437486f2168270c5caa0b4bf104 (diff) |
Fixed too many little issues, check the issues closed today.
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/line_edit.cpp | 3 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 48 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 9 |
3 files changed, 51 insertions, 9 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index e822cfef13..a77a40327f 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -212,7 +212,7 @@ void LineEdit::_input_event(InputEvent p_event) { emit_signal( "text_entered",text ); // notify to hide soft keyboard - notification(NOTIFICATION_FOCUS_EXIT); + notification(NOTIFICATION_FOCUS_EXIT); return; } break; @@ -677,6 +677,7 @@ void LineEdit::selection_delete() { undo_text = text; text.erase(selection.begin,selection.end-selection.begin); + cursor_pos-=CLAMP( cursor_pos-selection.begin, 0, selection.end-selection.begin); if (cursor_pos>=text.length()) { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 4095ddeb37..5934aaf126 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2611,20 +2611,53 @@ bool TextEdit::search(const String &p_key,uint32_t p_search_flags, int p_from_li int line=-1; int pos=-1; + line=p_from_line; + for(int i=0;i<text.size()+1;i++) { //backwards is broken... - int idx=(p_search_flags&SEARCH_BACKWARDS)?(text.size()-i):i; //do backwards seearch - line = (idx+p_from_line)%text.size(); + //int idx=(p_search_flags&SEARCH_BACKWARDS)?(text.size()-i):i; //do backwards seearch + + + if (line<0) { + line=text.size()-1; + } + if (line==text.size()) { + line=0; + } String text_line = text[line]; - int from_column=(idx==0)?p_from_column:0; - if (idx==text.size()) { - text_line=text_line.substr(0,p_from_column); //wrap around for missing begining. + int from_column=0; + if (line==p_from_line) { + + if (i==text.size()) { + //wrapped + + if (p_search_flags&SEARCH_BACKWARDS) { + text_line=text_line.substr(from_column,text_line.length()); + from_column=text_line.length(); + } else { + text_line=text_line.substr(0,from_column); + from_column=0; + } + + } else { + + from_column=p_from_column; + } + + + } else { + //text_line=text_line.substr(0,p_from_column); //wrap around for missing begining. + if (p_search_flags&SEARCH_BACKWARDS) + from_column=text_line.length()-1; + else + from_column=0; } pos=-1; if (!(p_search_flags&SEARCH_BACKWARDS)) { + pos = (p_search_flags&SEARCH_MATCH_CASE)?text_line.find(p_key,from_column):text_line.findn(p_key,from_column); } else { @@ -2642,6 +2675,11 @@ bool TextEdit::search(const String &p_key,uint32_t p_search_flags, int p_from_li if (pos!=-1) break; + if (p_search_flags&SEARCH_BACKWARDS) + line--; + else + line++; + } if (pos==-1) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 25f04379ef..9084983a4c 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3009,20 +3009,23 @@ TreeItem* Tree::_find_item_at_pos(TreeItem*p_item, const Point2& p_pos,int& r_co String Tree::get_tooltip(const Point2& p_pos) const { if (root) { + Point2 pos=p_pos; pos -= cache.bg->get_offset(); pos.y-=_get_title_button_height(); if (pos.y<0) return Control::get_tooltip(p_pos); - pos.x+=h_scroll->get_val(); - pos.y+=v_scroll->get_val(); + if (h_scroll->is_visible()) + pos.x+=h_scroll->get_val(); + if (v_scroll->is_visible()) + pos.y+=v_scroll->get_val(); int col,h; TreeItem *it = _find_item_at_pos(root,pos,col,h); - if (it) { + if (it) { String ret; if (it->get_tooltip(col)=="") |