libncurses: Import https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz changes

Change-Id: I3433d30ca01359fd2e3623ede96b531f0b39cbfa
Signed-off-by: micky387 <mickaelsaibi@free.fr>
diff --git a/ncurses/base/lib_refresh.c b/ncurses/base/lib_refresh.c
index a77bc48..bcaa462 100644
--- a/ncurses/base/lib_refresh.c
+++ b/ncurses/base/lib_refresh.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright 2020-2021,2023 Thomas E. Dickey                                *
+ * Copyright 1998-2010,2011 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -42,7 +43,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_refresh.c,v 1.45 2011/06/25 19:02:22 Vassili.Courzakis Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.48 2023/05/27 20:13:10 tom Exp $")
 
 NCURSES_EXPORT(int)
 wrefresh(WINDOW *win)
@@ -91,13 +92,21 @@
 
     T((T_CALLED("wnoutrefresh(%p)"), (void *) win));
 
-    /*
-     * This function will break badly if we try to refresh a pad.
-     */
-    if ((win == 0)
-	|| (win->_flags & _ISPAD))
+    if (win == NULL)
 	returnCode(ERR);
 
+    /*
+     * Handle pads as a special case.
+     */
+    if (IS_PAD(win)) {
+	returnCode(pnoutrefresh(win,
+				win->_pad._pad_y,
+				win->_pad._pad_x,
+				win->_pad._pad_top,
+				win->_pad._pad_left,
+				win->_pad._pad_bottom,
+				win->_pad._pad_right));
+    }
 #ifdef TRACE
     if (USE_TRACEF(TRACE_UPDATE)) {
 	_tracedump("...win", win);
@@ -199,7 +208,6 @@
 	    });
 
 	    if_WIDEC({
-		static cchar_t blank = BLANK;
 		int last_dst = begx + ((last_src < win->_maxx)
 				       ? last_src
 				       : win->_maxx);
@@ -245,6 +253,7 @@
 		 */
 		if (fix_left < dst_col || fix_right > last_dst) {
 		    for (j = fix_left; j <= fix_right; ++j) {
+			static cchar_t blank = BLANK;
 			nline->text[j] = blank;
 			CHANGED_CELL(nline, j);
 		    }