NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/58282: Sysinst terminal output size increased because curses



The following reply was made to PR lib/58282; it has been noted by GNATS.

From: Brett Lymn <blymn%internode.on.net@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost,
        Andreas Gustafsson <gson%gson.org@localhost>
Subject: Re: lib/58282: Sysinst terminal output size increased because curses
Date: Tue, 9 Jul 2024 16:47:11 +0930

 --qJffieIJ/2fyx+UO
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Wed, May 29, 2024 at 06:45:02PM +0000, Andreas Gustafsson wrote:
 >  
 >  Why can't this be optimized to a single instance of ^[[37m^[[44m
 >  followed multiple spaces?
 >  
 
 Please try the attached patch, see if this helps.
 
 -- 
 Brett Lymn
 --
 Sent from my NetBSD device.
 
 "We are were wolves",
 "You mean werewolves?",
 "No we were wolves, now we are something else entirely",
 "Oh"
 
 --qJffieIJ/2fyx+UO
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="pr-58282.diff"
 
 Index: color.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libcurses/color.c,v
 retrieving revision 1.47
 diff -u -r1.47 color.c
 --- color.c	19 Oct 2022 06:09:27 -0000	1.47
 +++ color.c	9 Jul 2024 07:14:43 -0000
 @@ -123,6 +123,7 @@
  
  	_cursesi_screen->COLORS = COLORS;
  	_cursesi_screen->COLOR_PAIRS = COLOR_PAIRS;
 +	_cursesi_screen->curpair = -1;
  
  	/* Reset terminal colour and colour pairs. */
  	if (orig_colors != NULL)
 @@ -540,6 +541,10 @@
  		return;
  
  	pair = PAIR_NUMBER((uint32_t)attr);
 +
 +	if (pair == _cursesi_screen->curpair)
 +		return;
 +
  	__CTRACE(__CTRACE_COLOR, "__set_color: %d, %d, %d\n", pair,
  	    _cursesi_screen->colour_pairs[pair].fore,
  	    _cursesi_screen->colour_pairs[pair].back);
 @@ -578,6 +583,8 @@
  			    0, __cputchar);
  		break;
  	}
 +
 +	_cursesi_screen->curpair = pair;
  	curscr->wattr &= ~__COLOR;
  	curscr->wattr |= attr & __COLOR;
  }
 @@ -611,6 +618,8 @@
  		}
  		break;
  	}
 +
 +	_cursesi_screen->curpair = -1;
  }
  
  /*
 @@ -620,6 +629,12 @@
  void
  __restore_colors(void)
  {
 +	/*
 +	 * forget foreground/background colour just in case it was
 +	 * changed.  We will reset them if required.
 +	 */
 +	_cursesi_screen->curpair = -1;
 +
  	if (can_change != 0)
  		switch (_cursesi_screen->color_type) {
  		case COLOR_HP:
 Index: curses_private.h
 ===================================================================
 RCS file: /cvsroot/src/lib/libcurses/curses_private.h,v
 retrieving revision 1.81
 diff -u -r1.81 curses_private.h
 --- curses_private.h	17 May 2024 23:32:50 -0000	1.81
 +++ curses_private.h	9 Jul 2024 07:14:43 -0000
 @@ -226,6 +226,7 @@
  #define	TABSIZE_DEFAULT		8   /* spaces. */
  	int	 COLORS;	/* Maximum colors on the screen */
  	int	 COLOR_PAIRS;	/* Maximum color pairs on the screen */
 +	short	 curpair;	/* current colour pair set on the terminal */
  	int	 My_term;	/* Use Def_term regardless. */
  	char	 GT;		/* Gtty indicates tabs. */
  	char	 NONL;		/* Term can't hack LF doing a CR. */
 Index: screen.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libcurses/screen.c,v
 retrieving revision 1.39
 diff -u -r1.39 screen.c
 --- screen.c	27 May 2024 14:30:43 -0000	1.39
 +++ screen.c	9 Jul 2024 07:14:43 -0000
 @@ -156,6 +156,7 @@
  	new_screen->nca = A_NORMAL;
  	new_screen->color_type = COLOR_NONE;
  	new_screen->COLOR_PAIRS = 0;
 +	new_screen->curpair = -1;
  	new_screen->old_mode = 1;
  	new_screen->stdbuf = NULL;
  	new_screen->stdscr = NULL;
 
 --qJffieIJ/2fyx+UO--
 


Home | Main Index | Thread Index | Old Index