summaryrefslogtreecommitdiff
path: root/src/ansi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ansi.rs')
-rw-r--r--src/ansi.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index 2b196145..ec139294 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -179,7 +179,7 @@ pub trait Handler {
fn set_title(&mut self, &str) {}
/// Set the cursor style
- fn set_cursor_style(&mut self, _: CursorStyle) {}
+ fn set_cursor_style(&mut self, _: Option<CursorStyle>) {}
/// A character to be displayed
fn input(&mut self, _c: char) {}
@@ -344,7 +344,7 @@ pub trait Handler {
}
/// Describes shape of cursor
-#[derive(Debug, Eq, PartialEq, Copy, Clone)]
+#[derive(Debug, Eq, PartialEq, Copy, Clone, Deserialize)]
pub enum CursorStyle {
/// Cursor is a block like `▒`
Block,
@@ -356,6 +356,12 @@ pub enum CursorStyle {
Beam,
}
+impl Default for CursorStyle {
+ fn default() -> CursorStyle {
+ CursorStyle::Block
+ }
+}
+
/// Terminal modes
#[derive(Debug, Eq, PartialEq)]
pub enum Mode {
@@ -1070,9 +1076,10 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W>
'u' => handler.restore_cursor_position(),
'q' => {
let style = match arg_or_default!(idx: 0, default: 0) {
- 0 ... 2 => CursorStyle::Block,
- 3 | 4 => CursorStyle::Underline,
- 5 | 6 => CursorStyle::Beam,
+ 0 => None,
+ 1 | 2 => Some(CursorStyle::Block),
+ 3 | 4 => Some(CursorStyle::Underline),
+ 5 | 6 => Some(CursorStyle::Beam),
_ => unhandled!()
};