diff options
-rw-r--r-- | src/history.rs | 5 | ||||
-rw-r--r-- | src/readline.rs | 6 | ||||
-rw-r--r-- | src/state.rs | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/history.rs b/src/history.rs index 3615ec9..83744ce 100644 --- a/src/history.rs +++ b/src/history.rs @@ -233,7 +233,12 @@ impl History { out.write_str(&format!("{} ", status.code().unwrap())); } } + if focus == Some(idx) { + out.set_fgcolor(textmode::color::BLACK); + out.set_bgcolor(textmode::color::CYAN); + } out.write_str("$ "); + out.reset_attributes(); if entry.running() { out.set_bgcolor(textmode::Color::Rgb(16, 64, 16)); } diff --git a/src/readline.rs b/src/readline.rs index 8d7a87f..11ea2dd 100644 --- a/src/readline.rs +++ b/src/readline.rs @@ -59,9 +59,15 @@ impl Readline { pub async fn render( &self, out: &mut textmode::Output, + focus: bool, ) -> anyhow::Result<()> { out.move_to(self.size.0 - 1, 0); + if focus { + out.set_fgcolor(textmode::color::BLACK); + out.set_bgcolor(textmode::color::CYAN); + } out.write_str(&self.prompt); + out.reset_attributes(); out.write_str(&self.input_line); out.move_to(self.size.0 - 1, self.prompt_width() + self.pos_width()); Ok(()) diff --git a/src/state.rs b/src/state.rs index d6fb231..ff26a75 100644 --- a/src/state.rs +++ b/src/state.rs @@ -32,7 +32,7 @@ impl State { self.history .render(&mut self.output, self.readline.lines(), None) .await?; - self.readline.render(&mut self.output).await?; + self.readline.render(&mut self.output, true).await?; } Focus::History(idx) => { self.history.render(&mut self.output, 0, Some(idx)).await?; |