Changed MoveToNextLine(0) and MoveToPreviousLine(0) to move 0 lines (#600)

This commit is contained in:
Nissa 2022-02-06 09:42:49 +00:00 committed by GitHub
parent 59f90fb586
commit aa4959f8f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,12 +83,18 @@ pub struct MoveToNextLine(pub u16);
impl Command for MoveToNextLine {
fn write_ansi(&self, f: &mut impl fmt::Write) -> fmt::Result {
write!(f, csi!("{}E"), self.0)
if self.0 != 0 {
write!(f, csi!("{}E"), self.0)?;
}
Ok(())
}
#[cfg(windows)]
fn execute_winapi(&self) -> Result<()> {
sys::move_to_next_line(self.0)
if self.0 != 0 {
sys::move_to_next_line(self.0)?;
}
Ok(())
}
}
@ -103,12 +109,18 @@ pub struct MoveToPreviousLine(pub u16);
impl Command for MoveToPreviousLine {
fn write_ansi(&self, f: &mut impl fmt::Write) -> fmt::Result {
write!(f, csi!("{}F"), self.0)
if self.0 != 0 {
write!(f, csi!("{}F"), self.0)?;
}
Ok(())
}
#[cfg(windows)]
fn execute_winapi(&self) -> Result<()> {
sys::move_to_previous_line(self.0)
if self.0 != 0 {
sys::move_to_previous_line(self.0)?;
}
Ok(())
}
}