You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Replace String comparisons with "", String() to is_empty()
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
This commit is contained in:
@@ -189,7 +189,7 @@ void CodeEdit::_notification(int p_what) {
|
||||
}
|
||||
|
||||
/* Code hint */
|
||||
if (caret_visible && code_hint != "" && (!code_completion_active || (code_completion_below != code_hint_draw_below))) {
|
||||
if (caret_visible && !code_hint.is_empty() && (!code_completion_active || (code_completion_below != code_hint_draw_below))) {
|
||||
const int font_height = font->get_height(font_size);
|
||||
Ref<StyleBox> sb = get_theme_stylebox(SNAME("panel"), SNAME("TooltipPanel"));
|
||||
Color font_color = get_theme_color(SNAME("font_color"), SNAME("TooltipLabel"));
|
||||
@@ -315,7 +315,7 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
}
|
||||
} else {
|
||||
if (mb->get_button_index() == MouseButton::LEFT) {
|
||||
if (mb->is_command_pressed() && symbol_lookup_word != String()) {
|
||||
if (mb->is_command_pressed() && !symbol_lookup_word.is_empty()) {
|
||||
Vector2i mpos = mb->get_position();
|
||||
if (is_layout_rtl()) {
|
||||
mpos.x = get_size().x - mpos.x;
|
||||
@@ -530,7 +530,7 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||
|
||||
/* General overrides */
|
||||
Control::CursorShape CodeEdit::get_cursor_shape(const Point2 &p_pos) const {
|
||||
if (symbol_lookup_word != String()) {
|
||||
if (!symbol_lookup_word.is_empty()) {
|
||||
return CURSOR_POINTING_HAND;
|
||||
}
|
||||
|
||||
@@ -2597,7 +2597,7 @@ void CodeEdit::_add_delimiter(const String &p_start_key, const String &p_end_key
|
||||
delimiter.type = p_type;
|
||||
delimiter.start_key = p_start_key;
|
||||
delimiter.end_key = p_end_key;
|
||||
delimiter.line_only = p_line_only || p_end_key == "";
|
||||
delimiter.line_only = p_line_only || p_end_key.is_empty();
|
||||
delimiters.insert(at, delimiter);
|
||||
if (!setting_delimiters) {
|
||||
delimiter_cache.clear();
|
||||
@@ -2647,7 +2647,7 @@ void CodeEdit::_set_delimiters(const TypedArray<String> &p_delimiters, Delimiter
|
||||
const String start_key = key.get_slice(" ", 0);
|
||||
const String end_key = key.get_slice_count(" ") > 1 ? key.get_slice(" ", 1) : String();
|
||||
|
||||
_add_delimiter(start_key, end_key, end_key == "", p_type);
|
||||
_add_delimiter(start_key, end_key, end_key.is_empty(), p_type);
|
||||
}
|
||||
setting_delimiters = false;
|
||||
_update_delimiter_cache();
|
||||
|
||||
Reference in New Issue
Block a user