Terminal Control

Full terminal manipulation with cursor control and screen management

Clear Screen
Clear the terminal screen
Clear Screen Example
use zfish::term::Terminal; // Clear entire screen Terminal::clear_screen()?; // Move to top-left corner Terminal::move_cursor(1, 1)?; println!("Screen cleared!");
Output
(Terminal screen cleared)
Cursor Movement
Move the cursor to specific positions
Cursor Movement Example
use zfish::term::Terminal; // Move cursor to position (row, col) - 1-indexed Terminal::move_cursor(10, 5)?; // Print at specific position Terminal::print_at(5, 10, "Hello at row 5, col 10")?; // Move and print Terminal::move_cursor(1, 1)?; println!("Top-left corner");
Output
(Cursor moved to specified positions)
Terminal Size
Get the current terminal dimensions
Terminal Size Example
use zfish::term::Terminal; // Get terminal size (width, height) if let Some((width, height)) = Terminal::size() { println!("Terminal size: {}x{}", width, height); } else { println!("Could not detect terminal size"); }
Output
Terminal size: 80x24\nRunning in a terminal
Hide/Show Cursor
Control cursor visibility
Cursor Visibility Example
use zfish::term; // Hide cursor term::hide_cursor()?; // Do some work... std::thread::sleep(std::time::Duration::from_secs(2)); // Show cursor again term::show_cursor()?;
Output
(Cursor hidden during operation, then shown again)