Skip to content

Commit

Permalink
fix terminal_size sep
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jul 12, 2024
1 parent 341b942 commit f709e99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ regex = "1.10.3"
serde = {version = "1", features = ["derive"]}
serde_json = "1"
serde_tuple = "0.5.0"
terminal_size = "0.3.0"
thread_local = "1"
time = "0.3.36"
tinyvec = {version = "1", features = ["alloc", "serde"]}
Expand All @@ -48,6 +47,7 @@ rustls = {version = "0.23.2", optional = true, default-features = false, feature
"tls12",
"ring",
]}
terminal_size = {version = "0.3.0", optional = true}
trash = {version = "4.0.0", optional = true}
viuer = {version = "0.7.1", optional = true}
webpki-roots = {version = "0.26.0", optional = true}
Expand Down Expand Up @@ -113,6 +113,7 @@ binary = [
"native_sys",
"ffi",
"terminal-light",
"terminal_size",
]
bytes = [] # No longer used
clipboard = ["arboard"]
Expand Down
7 changes: 6 additions & 1 deletion src/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2483,5 +2483,10 @@ pub fn now() -> f64 {
}

pub(crate) fn terminal_size() -> Option<(usize, usize)> {
terminal_size::terminal_size().map(|(w, h)| (w.0 as usize, h.0 as usize))
#[cfg(all(not(target_arch = "wasm32"), feature = "terminal_size"))]
{
terminal_size::terminal_size().map(|(w, h)| (w.0 as usize, h.0 as usize))
}
#[cfg(target_arch = "wasm32")]
None
}

0 comments on commit f709e99

Please sign in to comment.