[pacman-dev,v2] Go to the end of screen if 'printonly' mode enabled

Message ID 20201022163114.67131-1-anatol.pomozov@gmail.com
State New
Headers show
Series
  • [pacman-dev,v2] Go to the end of screen if 'printonly' mode enabled
Related show

Commit Message

Anatol Pomozov Oct. 22, 2020, 4:31 p.m. UTC
At the end of download operation our code makes sure the cursor is moved
to the end of the drawing area. But 'printonly' mode has its own if() branch
that skips this cursor alignment. Add cursor_goto_end() to the 'printonly'
codepath to make sure it does not clobber previous output.

Fixes FS#68355

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
---
 src/pacman/callback.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Allan McRae Nov. 26, 2020, 5:50 a.m. UTC | #1
On 23/10/20 2:31 am, Anatol Pomozov wrote:
> At the end of download operation our code makes sure the cursor is moved
> to the end of the drawing area. But 'printonly' mode has its own if() branch
> that skips this cursor alignment. Add cursor_goto_end() to the 'printonly'
> codepath to make sure it does not clobber previous output.
> 
> Fixes FS#68355
> 

Thanks - patch looks good and fixes the issue.

> Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
> ---
>  src/pacman/callback.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/pacman/callback.c b/src/pacman/callback.c
> index 4240a779..53518101 100644
> --- a/src/pacman/callback.c
> +++ b/src/pacman/callback.c
> @@ -226,6 +226,7 @@ static int number_length(size_t n)
>  void cb_event(alpm_event_t *event)
>  {
>  	if(config->print) {
> +		cursor_goto_end();
>  		return;
>  	}
>  	switch(event->type) {
>

Patch

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 4240a779..53518101 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -226,6 +226,7 @@  static int number_length(size_t n)
 void cb_event(alpm_event_t *event)
 {
 	if(config->print) {
+		cursor_goto_end();
 		return;
 	}
 	switch(event->type) {