### 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)

last_line = line;
			lines.append(line);
		}
	}
	for (const int &line : lines) {
		if (line != text_editor->get_line_count() - 1) {
			text_editor->remove_text(line, 0, line + 1, 0);
		} else {
			text_editor->remove_text(line - 1, text_editor->get_line(line - 1).length(), line, text_editor->get_line(line).length());
		}
		
		int new_line = MIN(line, text_editor->get_line_count() - 1);
		text_editor->unfold_line(new_line);
		for (const int &c : caret_edit_order) {
			if (text_editor->get_caret_line(c) == line || (text_editor->get_caret_line(c) == line + 1 && text_editor->get_caret_column(c) == 0)) {
				text_editor->deselect(c);
				text_editor->set_caret_line(new_line, c == 0, true, 0, c);
				continue;
			}
			if (text_editor->get_caret_line(c) > line) {
				text_editor->set_caret_line(text_editor->get_caret_line(c) - 1, c == 0, true, 0, c);
				continue;
			}
			break;
		}
	}
	text_editor->merge_overlapping_carets();
	text_editor->end_complex_operation();
}
void CodeTextEditor::duplicate_selection() {