aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parser/types.rs2
-rw-r--r--src/sequences/attribute.rs8
-rw-r--r--src/sequences/buffer.rs26
-rw-r--r--src/sequences/color.rs2
-rw-r--r--src/sequences/cursor.rs62
-rw-r--r--src/sequences/terminal.rs6
6 files changed, 54 insertions, 52 deletions
diff --git a/src/parser/types.rs b/src/parser/types.rs
index 66b6561..0371e1b 100644
--- a/src/parser/types.rs
+++ b/src/parser/types.rs
@@ -18,6 +18,8 @@ pub enum Sequence {
bitflags! {
/// A key modifiers.
+ #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+ #[repr(transparent)]
pub struct KeyModifiers: u8 {
const SHIFT = 0b0000_0001;
const CONTROL = 0b0000_0010;
diff --git a/src/sequences/attribute.rs b/src/sequences/attribute.rs
index 30961ff..b823dc3 100644
--- a/src/sequences/attribute.rs
+++ b/src/sequences/attribute.rs
@@ -2,19 +2,19 @@ use std::fmt;
sequence!(
/// Resets all attributes.
- ///
+ ///
/// This sequence resets all attributes previously set by the:
///
/// * [`SetAttribute`](struct.SetAttribute.html)
/// * [`SetForegroundColor`](struct.SetBackgroundColor.html)
/// * [`SetBackgroundColor`](struct.SetForegroundColor.html)
- ///
+ ///
/// # Examples
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::ResetAttributes;
- ///
+ ///
/// let mut stdout = stdout();
/// write!(stdout, "{}", ResetAttributes);
/// ```
diff --git a/src/sequences/buffer.rs b/src/sequences/buffer.rs
index 053195a..12d00a6 100644
--- a/src/sequences/buffer.rs
+++ b/src/sequences/buffer.rs
@@ -1,11 +1,11 @@
sequence!(
/// Switches to the alternate buffer.
- ///
+ ///
/// Use the [`SwitchBufferToNormal`](struct.SwitchBufferToNormal.html) sequence to switch
/// back to the normal buffer.
- ///
+ ///
/// # Examples
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::{SwitchBufferToAlternate, SwitchBufferToNormal};
@@ -20,9 +20,9 @@ sequence!(
sequence!(
/// Switches to the normal buffer.
- ///
+ ///
/// # Examples
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::{SwitchBufferToAlternate, SwitchBufferToNormal};
@@ -37,9 +37,9 @@ sequence!(
sequence!(
/// Scrolls up by the given number of rows.
- ///
+ ///
/// # Examples
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::ScrollBufferUp;
@@ -54,9 +54,9 @@ sequence!(
sequence!(
/// Scrolls down by the given number of rows.
- ///
+ ///
/// # Examples
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::ScrollBufferDown;
@@ -71,9 +71,9 @@ sequence!(
sequence!(
/// Clears part of the line.
- ///
+ ///
/// # Examples
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::ClearLine;
@@ -94,9 +94,9 @@ sequence!(
sequence!(
/// Clears part of the buffer.
- ///
+ ///
/// # Examples
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::ClearBuffer;
diff --git a/src/sequences/color.rs b/src/sequences/color.rs
index b019f0f..96ac0b4 100644
--- a/src/sequences/color.rs
+++ b/src/sequences/color.rs
@@ -181,7 +181,7 @@ test_sequences!(
SetBackgroundColor(Color::Yellow) => "\x1B[48;5;11m",
SetBackgroundColor(Color::Blue) => "\x1B[48;5;12m",
SetBackgroundColor(Color::Magenta) => "\x1B[48;5;13m",
- SetBackgroundColor(Color::Cyan) => "\x1B[48;5;14m",
+ SetBackgroundColor(Color::Cyan) => "\x1B[48;5;14m",
SetBackgroundColor(Color::White) => "\x1B[48;5;15m",
SetBackgroundColor(Color::Ansi(200)) => "\x1B[48;5;200m",
SetBackgroundColor(Color::Rgb(1, 2, 3)) => "\x1B[48;2;1;2;3m",
diff --git a/src/sequences/cursor.rs b/src/sequences/cursor.rs
index 37abc3b..7f07cb4 100644
--- a/src/sequences/cursor.rs
+++ b/src/sequences/cursor.rs
@@ -2,7 +2,7 @@
sequence!(
/// Saves the cursor position.
- ///
+ ///
/// Use the [`RestoreCursorPosition`](struct.RestoreCursorPosition.html) sequence to
/// restore the cursor position.
///
@@ -15,21 +15,21 @@ sequence!(
/// let mut stdout = stdout();
/// // Save cursor position
/// write!(stdout, "{}", SaveCursorPosition);
- ///
+ ///
/// // Your app
- ///
+ ///
/// // Restore cursor position
/// write!(stdout, "{}", RestoreCursorPosition);
- /// ```
- struct SaveCursorPosition => esc!("7")
+ /// ```
+ struct SaveCursorPosition => esc!("7")
);
sequence!(
/// Restores the cursor position.
- ///
+ ///
/// Use the [`SaveCursorPosition`](struct.SaveCursorPosition.html) sequence to
/// save the cursor position.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -39,9 +39,9 @@ sequence!(
/// let mut stdout = stdout();
/// // Save cursor position
/// write!(stdout, "{}", SaveCursorPosition);
- ///
+ ///
/// // Your app
- ///
+ ///
/// // Restore cursor position
/// write!(stdout, "{}", RestoreCursorPosition);
/// ```
@@ -50,9 +50,9 @@ sequence!(
sequence!(
/// Hides the cursor.
- ///
+ ///
/// Use the [`ShowCursor`](struct.ShowCursor.html) sequence to show the cursor.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -68,9 +68,9 @@ sequence!(
sequence!(
/// Shows the cursor.
- ///
- /// Use the [`HideCursor`](struct.HideCursor.html) sequence to hide the cursor.
- ///
+ ///
+ /// Use the [`HideCursor`](struct.HideCursor.html) sequence to hide the cursor.
+ ///
/// # Examples
///
/// ```no_run
@@ -86,10 +86,10 @@ sequence!(
sequence!(
/// Enables the cursor blinking.
- ///
+ ///
/// Use the [`DisableCursorBlinking`](struct.DisableCursorBlinking.html) sequence to disable
/// cursor blinking.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -105,10 +105,10 @@ sequence!(
sequence!(
/// Disables the cursor blinking.
- ///
+ ///
/// Use the [`EnableCursorBlinking`](struct.EnableCursorBlinking.html) sequence to enable
/// cursor blinking.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -128,7 +128,7 @@ sequence!(
/// # Notes
///
/// Top/left cell is represented as `1, 1` (`column, row`).
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -145,7 +145,7 @@ sequence!(
sequence!(
/// Moves the cursor up by the given number of rows.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -162,7 +162,7 @@ sequence!(
sequence!(
/// Moves the cursor down by the given number of rows.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -179,7 +179,7 @@ sequence!(
sequence!(
/// Moves the cursor right by the given number of columns.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -196,7 +196,7 @@ sequence!(
sequence!(
/// Moves the cursor left by the given number of columns.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -213,7 +213,7 @@ sequence!(
sequence!(
/// Moves the cursor to beginning of line the given number of lines down.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -224,9 +224,9 @@ sequence!(
/// // Move cursor down by 2 rows and the move it to the first column
/// write!(stdout, "{}", MoveCursorToNextLine(2));
/// ```
- ///
+ ///
/// The previous example does the same thing as the following one:
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::{MoveCursorDown, MoveCursorToColumn};
@@ -240,7 +240,7 @@ sequence!(
sequence!(
/// Moves the cursor to beginning of line the given number of lines up.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -251,9 +251,9 @@ sequence!(
/// // Move cursor up by 2 rows and the move it to the first column
/// write!(stdout, "{}", MoveCursorToPreviousLine(2));
/// ```
- ///
+ ///
/// The previous example does the same thing as the following one:
- ///
+ ///
/// ```no_run
/// use std::io::{stdout, Write};
/// use anes::{MoveCursorUp, MoveCursorToColumn};
@@ -271,7 +271,7 @@ sequence!(
/// # Notes
///
/// Beginning of the line (left cell) is represented as `1`.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -289,7 +289,7 @@ sequence!(
// TODO Enhance example with Parser to show how to retrieve it
sequence!(
/// Asks for the current cursor position.
- ///
+ ///
/// # Examples
///
/// ```no_run
diff --git a/src/sequences/terminal.rs b/src/sequences/terminal.rs
index 74eada6..fe27b67 100644
--- a/src/sequences/terminal.rs
+++ b/src/sequences/terminal.rs
@@ -2,7 +2,7 @@
sequence!(
/// Resizes the text area to the given width and height in characters.
- ///
+ ///
/// # Examples
///
/// ```no_run
@@ -19,7 +19,7 @@ sequence!(
sequence!(
/// Tells the terminal to start reporting mouse events.
- ///
+ ///
/// Mouse events are not reported by default.
struct EnableMouseEvents => concat!(
csi!("?1000h"),
@@ -50,5 +50,5 @@ test_sequences!(
),
disable_mouse_events(
DisableMouseEvents => "\x1B[?1006l\x1B[?1015l\x1B[?1002l\x1B[?1000l",
- )
+ )
);