Commit f48fe317 authored by Moritz Sokoll's avatar Moritz Sokoll 🦀
Browse files

implemented cursor stuff

parent ca920b49
......@@ -26,9 +26,7 @@ pub mod console {
/// function to perform an action for display controlling (using a `DisplayControl` enum)
/// # Arguments
/// *`sequence`: sequence to perform
/// # Returns
/// Returns a result for wether or not the sequence was executed correctly
pub fn dc_sequence(sequence: DisplayControl) -> std::io::Result<()> {
pub fn dc_sequence(sequence: DisplayControl) {
let seq: String = match sequence {
Clear => String::from("\x1b[2J"),
ClearLine => String::from("\x1b[2K"),
......@@ -36,7 +34,21 @@ pub mod console {
};
print!("{}", seq);
Ok(())
}
/// function to perform an action for cursor controlling (using a `CursorControl` enum)
/// # Arguments
/// *`sequence`: the sequence to perform
pub fn cc_sequence(sequence: CursorControl) {
let seq: String = match sequence {
Left(n) => format!("\x1b[{}D", n),
Right(n) => format!("\x1b[{}C", n),
Col(n) => format!("\x1b[{}G", n),
Up(n) => format!("\x1b[{}A"),
Down(n) => format!("\x1b[{}B", n),
Pos(x, y) => format!("\x1b[{};{}H", x, y),
};
print!("{}", seq);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment