Skip to content

Commit

Permalink
Move clear_until_new_line to be close to clear_line
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelmello committed Jan 4, 2024
1 parent d21ec46 commit 76ad0ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions inquire/src/terminal/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ impl Terminal for ConsoleTerminal {
self.term.clear_line()
}

fn clear_until_new_line(&mut self) -> Result<()> {
self.term.clear_to_end_of_screen()
}

fn cursor_hide(&mut self) -> Result<()> {
self.term.hide_cursor()
}
Expand All @@ -102,10 +106,6 @@ impl Terminal for ConsoleTerminal {
self.term.show_cursor()
}

fn clear_until_new_line(&mut self) -> Result<()> {
self.term.clear_to_end_of_screen()
}

fn get_in_memory_content(&self) -> &str {
&self.in_memory_content
}
Expand Down
8 changes: 4 additions & 4 deletions inquire/src/terminal/termion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ impl<'a> Terminal for TermionTerminal<'a> {
write!(self.get_writer(), "{}", termion::clear::CurrentLine)
}

fn clear_until_new_line(&mut self) -> Result<()> {
write!(self.get_writer(), "{}", termion::clear::UntilNewline)
}

fn cursor_hide(&mut self) -> Result<()> {
write!(self.get_writer(), "{}", termion::cursor::Hide)
}
Expand All @@ -203,10 +207,6 @@ impl<'a> Terminal for TermionTerminal<'a> {
write!(self.get_writer(), "{}", termion::cursor::Show)
}

fn clear_until_new_line(&mut self) -> Result<()> {
write!(self.get_writer(), "{}", termion::clear::UntilNewline)
}

fn get_in_memory_content(&self) -> &str {
self.in_memory_content.as_ref()
}
Expand Down

0 comments on commit 76ad0ca

Please sign in to comment.