Merge pull request #31392 from YeldhamDev/autocomplete_width_limit_fix

Fix autocompletion widget having its text leak outside
This commit is contained in:
Rémi Verschelde 2019-08-15 20:51:11 +02:00 committed by GitHub
commit de8ce3e625
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1403,7 +1403,7 @@ void TextEdit::_notification(int p_what) {
} }
int line_from = CLAMP(completion_index - lines / 2, 0, completion_options.size() - lines); int line_from = CLAMP(completion_index - lines / 2, 0, completion_options.size() - lines);
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(completion_rect.position.x, completion_rect.position.y + (completion_index - line_from) * get_row_height()), Size2(completion_rect.size.width, get_row_height())), cache.completion_selected_color); VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(completion_rect.position.x, completion_rect.position.y + (completion_index - line_from) * get_row_height()), Size2(completion_rect.size.width, get_row_height())), cache.completion_selected_color);
draw_rect(Rect2(completion_rect.position + Vector2(icon_area_size.x + icon_hsep, 0), Size2(nofs, completion_rect.size.height)), cache.completion_existing_color); draw_rect(Rect2(completion_rect.position + Vector2(icon_area_size.x + icon_hsep, 0), Size2(MIN(nofs, completion_rect.size.width - (icon_area_size.x + icon_hsep)), completion_rect.size.height)), cache.completion_existing_color);
for (int i = 0; i < lines; i++) { for (int i = 0; i < lines; i++) {
@ -1430,7 +1430,7 @@ void TextEdit::_notification(int p_what) {
} }
title_pos.x = icon_area.position.x + icon_area.size.width + icon_hsep; title_pos.x = icon_area.position.x + icon_area.size.width + icon_hsep;
draw_string(cache.font, title_pos, completion_options[l].display, text_color, completion_rect.size.width); draw_string(cache.font, title_pos, completion_options[l].display, text_color, completion_rect.size.width - (icon_area_size.x + icon_hsep));
} }
if (scrollw) { if (scrollw) {