|
@@ -1581,6 +1581,17 @@ void TextEdit::_notification(int p_what) {
|
|
|
Size2 icon_area_size(get_row_height(), get_row_height());
|
|
|
w += icon_area_size.width + icon_hsep;
|
|
|
|
|
|
+ int line_from = CLAMP(completion_index - lines / 2, 0, completion_options_size - lines);
|
|
|
+
|
|
|
+ for (int i = 0; i < lines; i++) {
|
|
|
+ int l = line_from + i;
|
|
|
+ ERR_CONTINUE(l < 0 || l >= completion_options_size);
|
|
|
+ if (completion_options[l].default_value.get_type() == Variant::COLOR) {
|
|
|
+ w += icon_area_size.width;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
int th = h + csb->get_minimum_size().y;
|
|
|
|
|
|
if (cursor_pos.y + get_row_height() + th > get_size().height) {
|
|
@@ -1606,7 +1617,6 @@ void TextEdit::_notification(int p_what) {
|
|
|
if (cache.completion_background_color.a > 0.01) {
|
|
|
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(completion_rect.position, completion_rect.size + Size2(scrollw, 0)), cache.completion_background_color);
|
|
|
}
|
|
|
- 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);
|
|
|
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);
|
|
|
|
|
@@ -1635,6 +1645,11 @@ void TextEdit::_notification(int p_what) {
|
|
|
}
|
|
|
|
|
|
title_pos.x = icon_area.position.x + icon_area.size.width + icon_hsep;
|
|
|
+
|
|
|
+ if (completion_options[l].default_value.get_type() == Variant::COLOR) {
|
|
|
+ draw_rect(Rect2(Point2(completion_rect.position.x + completion_rect.size.width - icon_area_size.x, icon_area.position.y), icon_area_size), (Color)completion_options[l].default_value);
|
|
|
+ }
|
|
|
+
|
|
|
draw_string(cache.font, title_pos, completion_options[l].display, text_color, completion_rect.size.width - (icon_area_size.x + icon_hsep));
|
|
|
}
|
|
|
|