remove terminal_size crate everywhere it makes sense (#14423)

# Description

This PR removes the `terminal_size` crate everywhere that it made sense.
I replaced it with crossterm's version called `size`. The places I
didn't remove it were the places that did not have a dependency on
crossterm. So, I thought it was "cheaper" to have a dep on term_size vs
crossterm in those locations.
This commit is contained in:
Darren Schroeder
2024-11-23 21:37:12 -06:00
committed by GitHub
parent 83d8e936ad
commit dd3a3a2717
8 changed files with 13 additions and 23 deletions

View File

@ -9,6 +9,7 @@ mod views;
use anyhow::Result;
use commands::{ExpandCmd, HelpCmd, NuCmd, QuitCmd, TableCmd, TryCmd};
use crossterm::terminal::size;
pub use default_context::add_explore_context;
pub use explore::Explore;
use explore::ExploreConfig;
@ -19,7 +20,6 @@ use nu_protocol::{
};
use pager::{Page, Pager, PagerConfig};
use registry::CommandRegistry;
use terminal_size::{Height, Width};
use views::{BinaryView, Orientation, Preview, RecordView};
mod util {
@ -80,7 +80,7 @@ fn create_record_view(
}
if config.tail {
if let Some((Width(w), Height(h))) = terminal_size::terminal_size() {
if let Ok((w, h)) = size() {
view.tail(w, h);
}
}