### Godot version

4.0 stable

### System information

Manjaro Linux, kernel 6.1.1-1-MANJARO, AMD Ryzen 5 3600, AMD RX 580

### Issue description

The `wrap_mode` property of the `TextEdit` node doesn't seem to really do anything. Setting it to `LINE_WRAPPING_BOUNDARY` simply means that there won't be an horizontal scrollbar if the text overshoots the boundary, instead of actually forcing the text to the next line so that it stays visible.

### Steps to reproduce

Create a TextEdit node and set its `wrap_mode` property to `LINE_WRAPPING_BOUNDARY`

### Minimal reproduction project

[WrapBugDemo.zip](https://github.com/godotengine/godot/files/10875969/WrapBugDemo.zip)

for (int i = from_line; i <= to_line; i++) {
			text_editor->unfold_line(i);
		}
		text_editor->deselect(c);
		text_editor->insert_text_at_caret(new_text, c);
		text_editor->set_caret_line(cursor_new_line, c == 0, true, 0, c);
		text_editor->set_caret_column(cursor_new_column, c == 0, c);
		if (selection_active) {
			text_editor->select(to_line, to_column, 2 * to_line - from_line, to_line == from_line ? 2 * to_column - from_column : to_column, c);
		}
	}
	text_editor->merge_overlapping_carets();
	text_editor->end_complex_operation();
	text_editor->queue_redraw();
}
void CodeTextEditor::toggle_inline_comment(const String &delimiter) {
	text_editor->begin_complex_operation();
	Vector<int> caret_edit_order = text_editor->get_caret_index_edit_order();
	caret_edit_order.reverse();
	int last_line = -1;
	int folded_to = 0;
	for (const int &c1 : caret_edit_order) {
		int from = _get_affected_lines_from(c1);
		from += from == last_line ? 1 + folded_to : 0;
		int to = _get_affected_lines_to(c1);
		last_line = to;
		
		if (text_editor->is_line_folded(to)) {
			folded_to = text_editor->get_next_visible_line_offset_from(to + 1, 1) - 1;
			to += folded_to;