fix: background color

The statusline and the command mode prompt will now both have the same
background when the editor.statusline.merge-with-commandline option is
set
pull/12204/head
Nik Revenco 2025-04-07 22:04:28 +01:00
parent da577cf1ac
commit f506116b38
2 changed files with 10 additions and 1 deletions

View File

@ -3253,6 +3253,11 @@ pub(super) fn command_mode(cx: &mut Context) {
None
});
if cx.editor.config().statusline.merge_with_commandline {
// command line prompt has the same background as the statusline when
// the statusline and the command line are merged
prompt.background = Some(cx.editor.theme.get("ui.statusline"))
}
// Calculate initial completion
prompt.recalculate_completion(cx.editor);

View File

@ -28,6 +28,7 @@ pub struct Prompt {
prompt: Cow<'static, str>,
line: String,
cursor: usize,
pub background: Option<helix_view::theme::Style>,
completion: Vec<Completion>,
selection: Option<usize>,
history_register: Option<char>,
@ -84,6 +85,7 @@ impl Prompt {
selection: None,
history_register,
history_pos: None,
background: None,
completion_fn: Box::new(completion_fn),
callback_fn: Box::new(callback_fn),
doc_fn: Box::new(|_| None),
@ -401,7 +403,9 @@ impl Prompt {
let completion_color = theme.get("ui.menu");
let selected_color = theme.get("ui.menu.selected");
let suggestion_color = theme.get("ui.text.inactive");
let background = theme.get("ui.background");
let background = self
.background
.unwrap_or_else(|| theme.get("ui.background"));
// completion
let max_len = self