-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from KP64/master
refactor: ➕ Added terminal_size dependency
- Loading branch information
Showing
8 changed files
with
34 additions
and
92 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crossterm::{cursor, ExecutableCommand}; | ||
use terminal_size::terminal_size; | ||
use std::io; | ||
|
||
/// Restore terminal settings. | ||
pub fn restore() { | ||
io::stdout() | ||
.execute(cursor::Show) | ||
.expect("Failed to restore cursor"); | ||
} | ||
|
||
/// Attempts to get the current size of the tty's window. Returns `None` if stdout isn't tty or if | ||
/// failed to get width. | ||
pub fn get_window_width() -> Option<usize> { | ||
Some(usize::from(terminal_size()?.0 .0)) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.