mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-03 01:19:38 +01:00
Backported from godot4: Fix TextEdit.get_rect_at_line_column returning negative pos even though cursor is in viewable area of the control
- MJacred
6170381bd7
This commit is contained in:
parent
a38d3e5d61
commit
8d67178204
@ -4825,10 +4825,16 @@ Rect2 TextEdit::get_rect_at_line_column(int p_line, int p_column) const {
|
|||||||
ERR_FAIL_COND_V(p_column < 0, Rect2i(-1, -1, 0, 0));
|
ERR_FAIL_COND_V(p_column < 0, Rect2i(-1, -1, 0, 0));
|
||||||
ERR_FAIL_COND_V(p_column > text[p_line].length(), Rect2i(-1, -1, 0, 0));
|
ERR_FAIL_COND_V(p_column > text[p_line].length(), Rect2i(-1, -1, 0, 0));
|
||||||
|
|
||||||
|
if (text.size() == 1 && text[0].length() == 0) {
|
||||||
|
// The TextEdit is empty.
|
||||||
|
return Rect2i();
|
||||||
|
}
|
||||||
|
|
||||||
if (line_drawing_cache.size() == 0 || !line_drawing_cache.has(p_line)) {
|
if (line_drawing_cache.size() == 0 || !line_drawing_cache.has(p_line)) {
|
||||||
// Line is not in the cache, which means it's outside of the viewing area.
|
// Line is not in the cache, which means it's outside of the viewing area.
|
||||||
return Rect2i(-1, -1, 0, 0);
|
return Rect2i(-1, -1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LineDrawingCache cache_entry = line_drawing_cache[p_line];
|
LineDrawingCache cache_entry = line_drawing_cache[p_line];
|
||||||
|
|
||||||
int wrap_index = get_line_wrap_index_at_col(p_line, p_column);
|
int wrap_index = get_line_wrap_index_at_col(p_line, p_column);
|
||||||
|
Loading…
Reference in New Issue
Block a user