diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/rich_text_label.cpp | 11 | ||||
-rw-r--r-- | scene/gui/split_container.cpp | 15 | ||||
-rw-r--r-- | scene/gui/tabs.cpp | 6 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 12 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 1 |
5 files changed, 28 insertions, 17 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 17de346f51..490013d813 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -765,19 +765,17 @@ void RichTextLabel::_update_scroll() { if (exceeds) { scroll_visible = true; - main->first_invalid_line = 0; scroll_w = vscroll->get_combined_minimum_size().width; vscroll->show(); vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -scroll_w); - _validate_line_caches(main); - } else { - scroll_visible = false; - vscroll->hide(); scroll_w = 0; - _validate_line_caches(main); + vscroll->hide(); } + + main->first_invalid_line = 0; //invalidate ALL + _validate_line_caches(main); } } @@ -1616,7 +1614,6 @@ void RichTextLabel::clear() { main->lines.clear(); main->lines.resize(1); main->first_invalid_line = 0; - scroll_w = 0; update(); selection.click = NULL; selection.active = false; diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index 3554f04cc0..c3265d3ed5 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -94,12 +94,15 @@ void SplitContainer::_resort() { } // Compute the final middle separation - int clamped_split_offset = CLAMP(split_offset, ms_first[axis] - no_offset_middle_sep, (get_size()[axis] - ms_second[axis] - sep) - no_offset_middle_sep); - middle_sep = no_offset_middle_sep + clamped_split_offset; - if (!collapsed && should_clamp_split_offset) { - split_offset = clamped_split_offset; - _change_notify("split_offset"); - should_clamp_split_offset = false; + middle_sep = no_offset_middle_sep; + if (!collapsed) { + int clamped_split_offset = CLAMP(split_offset, ms_first[axis] - no_offset_middle_sep, (get_size()[axis] - ms_second[axis] - sep) - no_offset_middle_sep); + middle_sep += clamped_split_offset; + if (should_clamp_split_offset) { + split_offset = clamped_split_offset; + _change_notify("split_offset"); + should_clamp_split_offset = false; + } } if (vertical) { diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index cf3113ca8c..4fe4271368 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -53,7 +53,7 @@ Size2 Tabs::get_minimum_size() const { ms.width += get_constant("hseparation"); } - ms.width += font->get_string_size(tabs[i].text).width; + ms.width += Math::ceil(font->get_string_size(tabs[i].text).width); if (tabs[i].disabled) ms.width += tab_disabled->get_minimum_size().width; @@ -547,7 +547,7 @@ void Tabs::_update_cache() { for (int i = 0; i < tabs.size(); i++) { tabs.write[i].ofs_cache = mw; tabs.write[i].size_cache = get_tab_width(i); - tabs.write[i].size_text = font->get_string_size(tabs[i].text).width; + tabs.write[i].size_text = Math::ceil(font->get_string_size(tabs[i].text).width); mw += tabs[i].size_cache; if (tabs[i].size_cache <= min_width || i == current) { size_fixed += tabs[i].size_cache; @@ -803,7 +803,7 @@ int Tabs::get_tab_width(int p_idx) const { x += get_constant("hseparation"); } - x += font->get_string_size(tabs[p_idx].text).width; + x += Math::ceil(font->get_string_size(tabs[p_idx].text).width); if (tabs[p_idx].disabled) x += tab_disabled->get_minimum_size().width; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 5fe6fcdfac..c339cf6374 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -5758,6 +5758,7 @@ void TextEdit::_update_completion_candidates() { completion_base = s; Vector<float> sim_cache; bool single_quote = s.begins_with("'"); + Vector<String> completion_options_casei; for (int i = 0; i < completion_strings.size(); i++) { if (single_quote && completion_strings[i].is_quoted()) { @@ -5766,9 +5767,13 @@ void TextEdit::_update_completion_candidates() { if (completion_strings[i].begins_with(s)) { completion_options.push_back(completion_strings[i]); + } else if (completion_strings[i].to_lower().begins_with(s.to_lower())) { + completion_options_casei.push_back(completion_strings[i]); } } + completion_options.append_array(completion_options_casei); + if (completion_options.size() == 0) { for (int i = 0; i < completion_strings.size(); i++) { if (s.is_subsequence_of(completion_strings[i])) { @@ -6040,7 +6045,10 @@ void TextEdit::menu_option(int p_option) { case MENU_UNDO: { undo(); } break; - }; + case MENU_REDO: { + redo(); + } + } } void TextEdit::set_select_identifiers_on_hover(bool p_enable) { @@ -6216,6 +6224,7 @@ void TextEdit::_bind_methods() { BIND_ENUM_CONSTANT(MENU_CLEAR); BIND_ENUM_CONSTANT(MENU_SELECT_ALL); BIND_ENUM_CONSTANT(MENU_UNDO); + BIND_ENUM_CONSTANT(MENU_REDO); BIND_ENUM_CONSTANT(MENU_MAX); GLOBAL_DEF("gui/timers/text_edit_idle_detect_sec", 3); @@ -6344,6 +6353,7 @@ TextEdit::TextEdit() { menu->add_item(RTR("Clear"), MENU_CLEAR); menu->add_separator(); menu->add_item(RTR("Undo"), MENU_UNDO, KEY_MASK_CMD | KEY_Z); + menu->add_item(RTR("Redo"), MENU_REDO, KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Z); menu->connect("id_pressed", this, "menu_option"); } diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 8a508a8738..b1a0b60442 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -444,6 +444,7 @@ public: MENU_CLEAR, MENU_SELECT_ALL, MENU_UNDO, + MENU_REDO, MENU_MAX }; |