forked from extern/nushell
Patch after fix after fix 7380 (#7501)
> I'm not sure how i feel about that. I mean if there are a lot of columns, it should probably have a max width so 1 column doesn't take the entire width of your screen. Ideally it would work closely like table worked before we migrated to tabled, as far as how column widths were allocated. I believe it still not completely matched. *To be honest I am not against the #7446 approach. The PR makes a switch between logics on a premise of `termwidth`. So if `termwidth > 120` we start prioritizing amount of columns we can show (We try to show as many columns as we can). Otherwise we do what I've described in #7446 (We show the least columns but with least truncation involvement). In case it's OK, I guess we could make the value configurable. cc @fdncred ref #7446 Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
@ -1701,6 +1701,10 @@ impl Iterator for PagingTableCreator {
|
||||
}
|
||||
}
|
||||
|
||||
if batch.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let table = match &self.view {
|
||||
TableView::General => self.build_general(&batch),
|
||||
TableView::Collapsed => self.build_collapsed(batch),
|
||||
@ -1723,8 +1727,12 @@ impl Iterator for PagingTableCreator {
|
||||
|
||||
Some(Ok(bytes))
|
||||
}
|
||||
Ok(None) => {
|
||||
let term_width = get_width_param(self.width_param);
|
||||
let msg = format!("Couldn't fit table into {} columns!", term_width);
|
||||
Some(Ok(msg.as_bytes().to_vec()))
|
||||
}
|
||||
Err(err) => Some(Err(err)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user