mirror of
https://github.com/nushell/nushell.git
synced 2025-04-14 08:18:17 +02:00
Fix error message when interrupting table with ctrl+c
(#7588)
`table` was displaying an incorrect "Couldn't fit table into X columns!" error when streaming was interrupted by `ctrl+c`:  This PR fixes that: 
This commit is contained in:
parent
a43e66ef92
commit
3d682fe957
@ -1725,8 +1725,14 @@ 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);
|
||||
let msg = if nu_utils::ctrl_c::was_pressed(&self.ctrlc) {
|
||||
"".into()
|
||||
} else {
|
||||
// assume this failed because the table was too wide
|
||||
// TODO: more robust error classification
|
||||
let term_width = get_width_param(self.width_param);
|
||||
format!("Couldn't fit table into {} columns!", term_width)
|
||||
};
|
||||
Some(Ok(msg.as_bytes().to_vec()))
|
||||
}
|
||||
Err(err) => Some(Err(err)),
|
||||
|
Loading…
Reference in New Issue
Block a user