From 76ad0ca816a0b74cc56736ad716065951c46e866 Mon Sep 17 00:00:00 2001 From: Mikael Mello Date: Thu, 4 Jan 2024 02:32:39 -0800 Subject: [PATCH] Move clear_until_new_line to be close to clear_line --- inquire/src/terminal/console.rs | 8 ++++---- inquire/src/terminal/termion.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/inquire/src/terminal/console.rs b/inquire/src/terminal/console.rs index 1e0e5d64..07cd902a 100644 --- a/inquire/src/terminal/console.rs +++ b/inquire/src/terminal/console.rs @@ -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() } @@ -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 } diff --git a/inquire/src/terminal/termion.rs b/inquire/src/terminal/termion.rs index d7504f88..699ab35f 100644 --- a/inquire/src/terminal/termion.rs +++ b/inquire/src/terminal/termion.rs @@ -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) } @@ -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() }