summaryrefslogtreecommitdiffstats
path: root/src/readline.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-11-13 04:36:45 -0500
committerJesse Luehrs <doy@tozt.net>2021-11-13 04:36:45 -0500
commit4b6bf2141459caf628f952678bf886a18927d8d2 (patch)
tree97d32a314b2eac6fbe0aabf666bd838021c10bb3 /src/readline.rs
parent153d4c4161fa8fba350dcc51ab14b08635c53e99 (diff)
downloadnbsh-4b6bf2141459caf628f952678bf886a18927d8d2.tar.gz
nbsh-4b6bf2141459caf628f952678bf886a18927d8d2.zip
highlight the focused entry
Diffstat (limited to 'src/readline.rs')
-rw-r--r--src/readline.rs6
1 files changed, 6 insertions, 0 deletions
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(())