### Godot version

Master branch [6758a7f]

### System information

Manjaro

### Issue description

`get_character_line` returns the wrong line on some characters when Autowrap Mode is not set to "Off". I couldn't understand the source of error, but apparently it happens when the text breaks lines in Autowrap "Arbitrary", or when the text auto-formats to remove extra space characters. The following images shows a case when this error happens:

![test1](https://github.com/godotengine/godot/assets/7095429/f8ff8eed-31aa-47ba-824e-2c0f18b1cf8e)
![test2](https://github.com/godotengine/godot/assets/7095429/994ee968-7418-4530-aa94-75eb1d6a9b61)

The problem is obvious on the the last two "c"s that should been on line 4, but instead only the last one is. This offset happened on the second letter "b", that should been line 1 (but it's shown as line 0).

### Steps to reproduce

Use a RichText label and set Autowrap mode to any option but "Off". Some texts might have this problem when you query for a character line.

### Minimal reproduction project

[bug_character_line.zip](https://github.com/godotengine/godot/files/12416662/bug_character_line.zip)

Vector2 off;
	bool line_clicked = false;
	float text_rect_begin = 0.0;
	int char_pos = -1;
	Line &l = p_frame->lines[p_line];
	MutexLock lock(l.text_buf->get_mutex());
	bool rtl = (l.text_buf->get_direction() == TextServer::DIRECTION_RTL);
	bool lrtl = is_layout_rtl();
	
	bool table_hit = false;
	Vector2i table_range;
	float table_offy = 0.f;
	ItemFrame *table_click_frame = nullptr;
	int table_click_line = -1;
	Item *table_click_item = nullptr;
	int table_click_char = -1;
	for (int line = 0; line < l.text_buf->get_line_count(); line++) {
		RID rid = l.text_buf->get_line_rid(line);
		float width = l.text_buf->get_width();
		float length = TS->shaped_text_get_width(rid);
		if (rtl) {
			off.x = p_width - l.offset.x - width;
			if (!lrtl && p_frame == main) { 
				off.x -= scroll_w;
			}
		} else {
			off.x = l.offset.x;
			if (lrtl && p_frame == main) { 
				off.x += scroll_w;
			}