|
|
@@ -443,33 +443,32 @@ void GtkRenderer::render_modeline_for_window(const Cairo::RefPtr<Cairo::Context>
|
|
|
void GtkRenderer::render_minibuffer(const Cairo::RefPtr<Cairo::Context>& cr, int width, int height) {
|
|
|
if (!core_.theme_manager().active_theme()) return;
|
|
|
|
|
|
- // Only render if minibuffer is active or a message is set
|
|
|
- if (!core_.minibuffer_manager().is_active() && core_.last_message().empty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // Calculate minibuffer position (bottom line with padding)
|
|
|
- double minibuffer_y = height - line_height_ - PADDING_BOTTOM;
|
|
|
- double minibuffer_x = PADDING_LEFT;
|
|
|
-
|
|
|
// Get theme colors
|
|
|
auto theme = core_.theme_manager().active_theme();
|
|
|
Color bg = theme->get_bg_color(ThemeElement::Background);
|
|
|
Color fg = theme->get_fg_color(ThemeElement::Normal);
|
|
|
|
|
|
- // Draw minibuffer background (slightly different shade)
|
|
|
+ // ALWAYS draw minibuffer background to prevent it from disappearing
|
|
|
// Clear the ENTIRE surface first to avoid artifacts
|
|
|
cr->set_source_rgb(bg.r / 255.0 * 0.9, bg.g / 255.0 * 0.9, bg.b / 255.0 * 0.9);
|
|
|
cr->rectangle(0, 0, width, height); // Clear full dedicated area
|
|
|
cr->fill();
|
|
|
|
|
|
- // Draw separator line above minibuffer (optional if dedicated area)
|
|
|
- // We can draw it at the very top 0
|
|
|
+ // Draw separator line above minibuffer
|
|
|
cr->set_source_rgb(fg.r / 255.0 * 0.5, fg.g / 255.0 * 0.5, fg.b / 255.0 * 0.5);
|
|
|
cr->set_line_width(1.0);
|
|
|
cr->move_to(0, 0);
|
|
|
cr->line_to(width, 0);
|
|
|
cr->stroke();
|
|
|
+
|
|
|
+ // Only render text if minibuffer is active or a message is set
|
|
|
+ if (!core_.minibuffer_manager().is_active() && core_.last_message().empty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Calculate minibuffer position (bottom line with padding)
|
|
|
+ double minibuffer_y = height - line_height_ - PADDING_BOTTOM;
|
|
|
+ double minibuffer_x = PADDING_LEFT;
|
|
|
|
|
|
// Prepare minibuffer text
|
|
|
std::string minibuffer_text;
|
|
|
@@ -525,13 +524,18 @@ void GtkRenderer::render_minibuffer(const Cairo::RefPtr<Cairo::Context>& cr, int
|
|
|
if (current_completion && input_part != *current_completion) {
|
|
|
std::string completion_suffix = current_completion->substr(input_part.length());
|
|
|
if (!completion_suffix.empty()) {
|
|
|
- auto completion_layout = Pango::Layout::create(cr);
|
|
|
+ // Calculate width of existing text to position suffix
|
|
|
+ Pango::Rectangle ink_rect, logical_rect;
|
|
|
+ layout->get_pixel_extents(ink_rect, logical_rect);
|
|
|
+ double text_width = logical_rect.get_width();
|
|
|
+
|
|
|
+ auto completion_layout = Pango::Layout::create(main_drawing_area_.get_pango_context());
|
|
|
completion_layout->set_font_description(font_desc_);
|
|
|
- completion_layout->set_text(minibuffer_text + completion_suffix);
|
|
|
+ completion_layout->set_text(completion_suffix); // Only draw suffix
|
|
|
|
|
|
Pango::AttrList completion_attr_list;
|
|
|
- if (auto face = theme->get_face("minibuffer-completion")) { // Assuming a face for completion
|
|
|
- apply_face_attributes(completion_attr_list, *face, static_cast<int>(minibuffer_text.length()), static_cast<int>(completion_suffix.length()));
|
|
|
+ if (auto face = theme->get_face("minibuffer-completion")) {
|
|
|
+ apply_face_attributes(completion_attr_list, *face, 0, static_cast<int>(completion_suffix.length()));
|
|
|
} else {
|
|
|
// Fallback: dimmed foreground
|
|
|
Color dim_fg = fg;
|
|
|
@@ -539,14 +543,14 @@ void GtkRenderer::render_minibuffer(const Cairo::RefPtr<Cairo::Context>& cr, int
|
|
|
dim_fg.g = static_cast<unsigned char>(dim_fg.g * 0.7);
|
|
|
dim_fg.b = static_cast<unsigned char>(dim_fg.b * 0.7);
|
|
|
auto attr = Pango::Attribute::create_attr_foreground(dim_fg.r * 257, dim_fg.g * 257, dim_fg.b * 257);
|
|
|
- attr.set_start_index(static_cast<int>(minibuffer_text.length()));
|
|
|
- attr.set_end_index(static_cast<int>(minibuffer_text.length() + completion_suffix.length()));
|
|
|
+ attr.set_start_index(0);
|
|
|
+ attr.set_end_index(static_cast<int>(completion_suffix.length()));
|
|
|
completion_attr_list.insert(attr);
|
|
|
}
|
|
|
completion_layout->set_attributes(completion_attr_list);
|
|
|
|
|
|
cr->set_source_rgb(fg.r / 255.0, fg.g / 255.0, fg.b / 255.0);
|
|
|
- cr->move_to(minibuffer_x, minibuffer_y);
|
|
|
+ cr->move_to(minibuffer_x + text_width, minibuffer_y); // Position after text
|
|
|
completion_layout->show_in_cairo_context(cr);
|
|
|
}
|
|
|
}
|