mirror of
https://github.com/nushell/nushell.git
synced 2025-01-24 07:09:02 +01: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`: ![image](https://user-images.githubusercontent.com/26268125/209415204-cc20964b-fc43-42a0-867f-1b01cefb3213.png) This PR fixes that: ![image](https://user-images.githubusercontent.com/26268125/209415163-b3041357-7f16-4a17-b15a-170b4d50f5ee.png)
This commit is contained in:
parent
a43e66ef92
commit
3d682fe957
@ -1725,8 +1725,14 @@ impl Iterator for PagingTableCreator {
|
|||||||
Some(Ok(bytes))
|
Some(Ok(bytes))
|
||||||
}
|
}
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
let term_width = get_width_param(self.width_param);
|
let msg = if nu_utils::ctrl_c::was_pressed(&self.ctrlc) {
|
||||||
let msg = format!("Couldn't fit table into {} columns!", term_width);
|
"".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()))
|
Some(Ok(msg.as_bytes().to_vec()))
|
||||||
}
|
}
|
||||||
Err(err) => Some(Err(err)),
|
Err(err) => Some(Err(err)),
|
||||||
|
Loading…
Reference in New Issue
Block a user