1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

more: error handling for write_all in function paging_add_back_message

This commit is contained in:
Ideflop 2023-05-30 09:03:00 +02:00
parent 6c98b23e80
commit f1c943ed31

View file

@ -344,7 +344,7 @@ fn more(
.. ..
}) => { }) => {
pager.page_up(); pager.page_up();
paging_add_back_message(options, stdout); paging_add_back_message(options, stdout)?;
} }
Event::Key(KeyEvent { Event::Key(KeyEvent {
code: KeyCode::Char('j'), code: KeyCode::Char('j'),
@ -556,11 +556,12 @@ impl<'a> Pager<'a> {
} }
} }
fn paging_add_back_message(options: &Options, stdout: &mut std::io::Stdout) { fn paging_add_back_message(options: &Options, stdout: &mut std::io::Stdout) -> UResult<()> {
if options.lines.is_some() { if options.lines.is_some() {
execute!(stdout, MoveUp(1)).unwrap(); execute!(stdout, MoveUp(1))?;
stdout.write_all("\n\r...back 1 page\n".as_bytes()).unwrap(); stdout.write_all("\n\r...back 1 page\n".as_bytes())?;
} }
Ok(())
} }
// Break the lines on the cols of the terminal // Break the lines on the cols of the terminal