summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/history.rs28
-rw-r--r--src/readline.rs6
-rw-r--r--src/state.rs2
3 files changed, 14 insertions, 22 deletions
diff --git a/src/history.rs b/src/history.rs
index 7e8a836..6c31b10 100644
--- a/src/history.rs
+++ b/src/history.rs
@@ -59,11 +59,7 @@ impl History {
}
if let Some((pos, hide)) = cursor {
out.move_to(pos.0, pos.1);
- if hide {
- out.write(b"\x1b[?25l");
- } else {
- out.write(b"\x1b[?25h");
- }
+ out.hide_cursor(hide);
}
Ok(())
}
@@ -239,22 +235,22 @@ impl HistoryEntry {
out.reset_attributes();
if self.binary() {
- let msg = b"This appears to be binary data. Fullscreen this entry to view anyway.";
+ let msg = "This appears to be binary data. Fullscreen this entry to view anyway.";
let len: u16 = msg.len().try_into().unwrap();
out.move_to(
out.screen().cursor_position().0 + 1,
(width - len) / 2,
);
out.set_fgcolor(textmode::color::RED);
- out.write(msg);
- out.write(b"\x1b[?25l");
+ out.write_str(msg);
+ out.hide_cursor(true);
out.reset_attributes();
} else {
let last_row = self.lines(width, focused && !scrolling);
if last_row > 5 {
out.write(b"\r\n");
out.set_fgcolor(textmode::color::BLUE);
- out.write(b"...");
+ out.write_str("...");
out.reset_attributes();
}
let mut out_row = out.screen().cursor_position().0 + 1;
@@ -269,9 +265,9 @@ impl HistoryEntry {
.skip(last_row.saturating_sub(5))
{
let idx: u16 = idx.try_into().unwrap();
- out.write(b"\x1b[m");
+ out.reset_attributes();
if !wrapped {
- out.write(format!("\x1b[{}H", out_row + 1).as_bytes());
+ out.move_to(out_row, 0);
}
out.write(&row);
wrapped = screen.row_wrapped(idx);
@@ -282,14 +278,10 @@ impl HistoryEntry {
}
if focused && !scrolling {
if let Some(row) = cursor_found {
- if screen.hide_cursor() {
- out.write(b"\x1b[?25l");
- } else {
- out.write(b"\x1b[?25h");
- out.move_to(row, pos.1);
- }
+ out.hide_cursor(screen.hide_cursor());
+ out.move_to(row, pos.1);
} else {
- out.write(b"\x1b[?25l");
+ out.hide_cursor(true);
}
}
}
diff --git a/src/readline.rs b/src/readline.rs
index aef817a..38c1e51 100644
--- a/src/readline.rs
+++ b/src/readline.rs
@@ -83,9 +83,9 @@ impl Readline {
out.move_to(self.size.0 - 2, 0);
out.set_bgcolor(textmode::Color::Rgb(32, 32, 64));
out.write(b"\x1b[K");
- out.write(b" (");
+ out.write_str(" (");
out.write_str(&pwd);
- out.write(b")");
+ out.write_str(")");
out.move_to(self.size.0 - 2, self.size.1 - 4 - idlen - timelen);
out.write_str(&id);
out.write_str(" [");
@@ -107,7 +107,7 @@ impl Readline {
out.reset_attributes();
out.move_to(self.size.0 - 1, self.prompt_width() + self.pos_width());
if focus {
- out.write(b"\x1b[?25h");
+ out.hide_cursor(false);
}
Ok(())
}
diff --git a/src/state.rs b/src/state.rs
index 38c4a3c..49e8320 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -175,7 +175,7 @@ impl State {
self.readline
.render(out, idx.is_none(), self.offset)
.await?;
- out.write(b"\x1b[?25l");
+ out.hide_cursor(true);
}
},
Scene::Fullscreen => {