### Godot version

4.0 beta 15

### System information

Windows 10

### Issue description

It happened with both Google IME and MS-IME, and there was no problem until Beta14.
When typing Japanese characters, it is common to select a character from the suggestion window and then start typing the next character before confirming.
In this case, uncommitted characters are forcibly committed, and input of the next character begins.

**↓Beta15**

https://user-images.githubusercontent.com/186786/214753450-b493cca6-2644-4b3d-8cd2-660565cc3547.mp4

**↓Beta14**

https://user-images.githubusercontent.com/186786/214755127-dde819cc-4d63-403a-99b0-09821671f74e.mp4



### Steps to reproduce

It happened with both Google IME and MS-IME in beta15

### Minimal reproduction project

It is project independent and happens in the editor.
ERR_FAIL_INDEX(p_line, text.size());
	ERR_FAIL_COND(p_char < 0);
	
	const String text_to_insert = p_text.replace("\r", "");
	Vector<String> substrings = text_to_insert.split("\n");
	
	bool shift_first_line = p_char == 0 && substrings.size() == 2 && text_to_insert == "\n";
	
	while (p_char > text[p_line].length()) {
		text.set(p_line, text[p_line] + String::chr(' '), structured_text_parser(st_parser, st_args, text[p_line] + String::chr(' ')));
	}
	
	String postinsert_text = text[p_line].substr(p_char, text[p_line].size());
	substrings.write[0] = text[p_line].substr(0, p_char) + substrings[0];
	substrings.write[substrings.size() - 1] += postinsert_text;
	Vector<Array> bidi_override;
	bidi_override.resize(substrings.size());
	for (int i = 0; i < substrings.size(); i++) {
		bidi_override.write[i] = structured_text_parser(st_parser, st_args, substrings[i]);
	}
	text.insert(p_line, substrings, bidi_override);
	if (shift_first_line) {
		text.move_gutters(p_line, p_line + 1);
		text.set_hidden(p_line + 1, text.is_hidden(p_line));
		text.set_hidden(p_line, false);
	}
	r_end_line = p_line + substrings.size() - 1;
	r_end_column = text[r_end_line].length() - postinsert_text.length();
	TextServer::Direction dir = TS->shaped_text_get_dominant_direction_in_range(text.get_line_data(r_end_line)->get_rid(), (r_end_line == p_line) ? carets[0].column : 0, r_end_column);