Changed MoveToNextLine(0) and MoveToPreviousLine(0) to move 0 lines (#600)
This commit is contained in:
parent
59f90fb586
commit
aa4959f8f5
@ -83,12 +83,18 @@ pub struct MoveToNextLine(pub u16);
|
|||||||
|
|
||||||
impl Command for MoveToNextLine {
|
impl Command for MoveToNextLine {
|
||||||
fn write_ansi(&self, f: &mut impl fmt::Write) -> fmt::Result {
|
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)]
|
#[cfg(windows)]
|
||||||
fn execute_winapi(&self) -> Result<()> {
|
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 {
|
impl Command for MoveToPreviousLine {
|
||||||
fn write_ansi(&self, f: &mut impl fmt::Write) -> fmt::Result {
|
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)]
|
#[cfg(windows)]
|
||||||
fn execute_winapi(&self) -> Result<()> {
|
fn execute_winapi(&self) -> Result<()> {
|
||||||
sys::move_to_previous_line(self.0)
|
if self.0 != 0 {
|
||||||
|
sys::move_to_previous_line(self.0)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user