> Date: Wed, 3 Jun 2020 12:46:48 +0200
> From: Klemens Nanni <k...@openbsd.org>
>     
> i_process() prints process lines from the global buffer thisline[MAX_COLS]
> which is filed by format_next_process() using snprintf(3), i.e. it is
> guaranteed to be NUL terminated.
>     
> display_width is always set to screen_width and capped to MAX_COLS-1
> in display_resize(), so NUL terminating thisline[] at index
> display_width is not only redundant but also cuts off the last visibile
> character for each process line.
>     
> Remove this redundancy to make top use the entire line and not have
> process names (or arguments) end one char too early in interactive use.
> 
> Feedback? OK?

Does that write into the last column of a 80-character wide screen?
That causes a linewrap on some terminals isn't it?  And that would be
undesirable.

> diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c
> index ff02198638e..3be47e6c5dd 100644
> --- a/usr.bin/top/display.c
> +++ b/usr.bin/top/display.c
> @@ -540,9 +540,6 @@ i_process(int line, char *thisline, int hl)
>       /* make sure we are on the correct line */
>       move(y_procs + line, 0);
>  
> -     /* truncate the line to conform to our current screen width */
> -     thisline[display_width] = '\0';
> -
>       /* write the line out */
>       if (hl && smart_terminal)
>               standoutp();
> 
> 

Reply via email to