mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-01 00:50:57 +00:00
ui: fill in default term width globally and return as usize
I'm going to add more ui.term_width() callers, and it's unlikely we'll have to set different defaults or error out.
This commit is contained in:
parent
b2b86825cb
commit
1977748642
3 changed files with 4 additions and 4 deletions
|
@ -2139,7 +2139,7 @@ pub enum LogContentFormat {
|
|||
impl LogContentFormat {
|
||||
pub fn new(ui: &Ui, settings: &UserSettings) -> Result<Self, config::ConfigError> {
|
||||
if settings.config().get_bool("ui.log-word-wrap")? {
|
||||
let term_width = usize::from(ui.term_width().unwrap_or(80));
|
||||
let term_width = ui.term_width();
|
||||
Ok(LogContentFormat::Wrap { term_width })
|
||||
} else {
|
||||
Ok(LogContentFormat::NoWrap)
|
||||
|
|
|
@ -257,7 +257,7 @@ impl<'a> DiffRenderer<'a> {
|
|||
DiffFormat::Stat => {
|
||||
let tree_diff = from_tree.diff_stream(to_tree, matcher);
|
||||
// TODO: In graph log, graph width should be subtracted
|
||||
let width = usize::from(ui.term_width().unwrap_or(80));
|
||||
let width = ui.term_width();
|
||||
show_diff_stat(formatter, store, tree_diff, path_converter, width)?;
|
||||
}
|
||||
DiffFormat::Types => {
|
||||
|
|
|
@ -578,8 +578,8 @@ impl Ui {
|
|||
rpassword::prompt_password(format!("{prompt}: "))
|
||||
}
|
||||
|
||||
pub fn term_width(&self) -> Option<u16> {
|
||||
term_width()
|
||||
pub fn term_width(&self) -> usize {
|
||||
term_width().unwrap_or(80).into()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue