### Godot version

v4.0.2.stable.official [7a0977ce2]

### System information

Windows 10, not platform specific

### Issue description

Methods `get_character_line` and `get_character_paragraph` return wrong indices for characters that are first in the respective line/paragraph. See the attached screenshot.

![image](https://user-images.githubusercontent.com/892180/236546781-692603be-eb09-419e-822e-d4152a66d9b6.png)


### Steps to reproduce

Run attached project.

The script goes through all characters in `RichTextLabel` and prints the respective character, line index, and paragraph index. None of them should be -1 since we are iterating through valid indices.

### Minimal reproduction project

[RichTextLabel.zip](https://github.com/godotengine/godot/files/11409399/RichTextLabel.zip)

Vector2 fbg_line_off = off + p_ofs;
		
		Vector2i chr_range = TS->shaped_text_get_range(rid);
		_draw_fbg_boxes(ci, rid, fbg_line_off, it_from, it_to, chr_range.x, chr_range.y, 0);
		
		Color selection_bg = theme_cache.selection_color;
		int sel_start = -1;
		int sel_end = -1;
		if (selection.active && (selection.from_frame->lines[selection.from_line].char_offset + selection.from_char) <= (l.char_offset + TS->shaped_text_get_range(rid).y) && (selection.to_frame->lines[selection.to_line].char_offset + selection.to_char) >= (l.char_offset + TS->shaped_text_get_range(rid).x)) {
			sel_start = MAX(TS->shaped_text_get_range(rid).x, (selection.from_frame->lines[selection.from_line].char_offset + selection.from_char) - l.char_offset);
			sel_end = MIN(TS->shaped_text_get_range(rid).y, (selection.to_frame->lines[selection.to_line].char_offset + selection.to_char) - l.char_offset);
			Vector<Vector2> sel = TS->shaped_text_get_selection(rid, sel_start, sel_end);
			for (int i = 0; i < sel.size(); i++) {
				Rect2 rect = Rect2(sel[i].x + p_ofs.x + off.x, p_ofs.y + off.y - TS->shaped_text_get_ascent(rid), sel[i].y - sel[i].x, TS->shaped_text_get_size(rid).y);
				RenderingServer::get_singleton()->canvas_item_add_rect(ci, rect, selection_bg);
			}
		}
		Vector2 ul_start;
		bool ul_started = false;
		Color ul_color;
		Vector2 dot_ul_start;
		bool dot_ul_started = false;
		Color dot_ul_color;
		Vector2 st_start;
		bool st_started = false;
		Color st_color;
		for (int i = 0; i < gl_size; i++) {
			bool selected = selection.active && (sel_start != -1) && (glyphs[i].start >= sel_start) && (glyphs[i].end <= sel_end);
			Item *it = _get_item_at_pos(it_from, it_to, glyphs[i].start);
			Color font_color = _find_color(it, p_base_color);