diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/line_edit.cpp | 9 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 18 |
2 files changed, 12 insertions, 15 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 15fd22ced5..dc48ce9045 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -577,13 +577,12 @@ void LineEdit::drop_data(const Point2 &p_point, const Variant &p_data) { if (p_data.get_type() == Variant::STRING) { set_caret_at_pixel_pos(p_point.x); - int selected = selection.end - selection.begin; - text.erase(selection.begin, selected); + text = text.left(selection.begin) + text.substr(selection.end); _shape(); insert_text_at_caret(p_data); - selection.begin = caret_column - selected; + selection.begin = caret_column - (selection.end - selection.begin); selection.end = caret_column; } } @@ -1244,7 +1243,7 @@ void LineEdit::delete_char() { return; } - text.erase(caret_column - 1, 1); + text = text.left(caret_column - 1) + text.substr(caret_column); _shape(); set_caret_column(get_caret_column() - 1); @@ -1256,7 +1255,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) { ERR_FAIL_COND_MSG(p_from_column < 0 || p_from_column > p_to_column || p_to_column > text.length(), vformat("Positional parameters (from: %d, to: %d) are inverted or outside the text length (%d).", p_from_column, p_to_column, text.length())); - text.erase(p_from_column, p_to_column - p_from_column); + text = text.left(p_from_column) + text.substr(p_to_column); _shape(); caret_column -= CLAMP(caret_column - p_from_column, 0, p_to_column - p_from_column); diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index d782016e08..6ea6742c7b 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -3450,7 +3450,7 @@ void VisualShaderNodeGroupBase::add_input_port(int p_id, int p_type, const Strin count++; } - inputs.erase(index, count); + inputs = inputs.left(index) + inputs.substr(index + count); inputs = inputs.insert(index, itos(i)); index += inputs_strings[i].size(); } @@ -3473,7 +3473,7 @@ void VisualShaderNodeGroupBase::remove_input_port(int p_id) { } index += inputs_strings[i].size(); } - inputs.erase(index, count); + inputs = inputs.left(index) + inputs.substr(index + count); inputs_strings = inputs.split(";", false); inputs = inputs.substr(0, index); @@ -3526,7 +3526,7 @@ void VisualShaderNodeGroupBase::add_output_port(int p_id, int p_type, const Stri count++; } - outputs.erase(index, count); + outputs = outputs.left(index) + outputs.substr(index + count); outputs = outputs.insert(index, itos(i)); index += outputs_strings[i].size(); } @@ -3549,7 +3549,7 @@ void VisualShaderNodeGroupBase::remove_output_port(int p_id) { } index += outputs_strings[i].size(); } - outputs.erase(index, count); + outputs = outputs.left(index) + outputs.substr(index + count); outputs_strings = outputs.split(";", false); outputs = outputs.substr(0, index); @@ -3601,8 +3601,7 @@ void VisualShaderNodeGroupBase::set_input_port_type(int p_id, int p_type) { index += inputs_strings[i].size(); } - inputs.erase(index, count); - + inputs = inputs.left(index) + inputs.substr(index + count); inputs = inputs.insert(index, itos(p_type)); _apply_port_changes(); @@ -3637,8 +3636,7 @@ void VisualShaderNodeGroupBase::set_input_port_name(int p_id, const String &p_na index += inputs_strings[i].size(); } - inputs.erase(index, count); - + inputs = inputs.left(index) + inputs.substr(index + count); inputs = inputs.insert(index, p_name); _apply_port_changes(); @@ -3673,7 +3671,7 @@ void VisualShaderNodeGroupBase::set_output_port_type(int p_id, int p_type) { index += output_strings[i].size(); } - outputs.erase(index, count); + outputs = outputs.left(index) + outputs.substr(index + count); outputs = outputs.insert(index, itos(p_type)); @@ -3709,7 +3707,7 @@ void VisualShaderNodeGroupBase::set_output_port_name(int p_id, const String &p_n index += output_strings[i].size(); } - outputs.erase(index, count); + outputs = outputs.left(index) + outputs.substr(index + count); outputs = outputs.insert(index, p_name); |