ncurses 6.2 - patch 20210213
[ncurses.git] / ncurses / base / lib_box.c
index 06ae284f4b74edb8ea3bf61b17056c895e11d819..186f11218720953dd44ee784278e79ba55a84898 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2009 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2010,2017 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_box.c,v 1.23 2009/10/24 22:33:46 tom Exp $")
+MODULE_ID("$Id: lib_box.c,v 1.26 2020/02/02 23:34:34 tom Exp $")
 
 #if USE_WIDEC_SUPPORT
 static NCURSES_INLINE chtype
@@ -51,8 +52,9 @@ _my_render(WINDOW *win, chtype ch)
     NCURSES_CH_T wch;
     SetChar2(wch, ch);
     wch = _nc_render(win, wch);
-    return CharOf(wch) | AttrOf(wch);
+    return ((attr_t) CharOf(wch)) | AttrOf(wch);
 }
+
 #define RENDER_WITH_DEFAULT(ch,def) w ## ch = _my_render(win, (ch == 0) ? def : ch)
 #else
 #define RENDER_WITH_DEFAULT(ch,def) w ## ch = _nc_render(win, (ch == 0) ? def : ch)
@@ -113,10 +115,20 @@ wborder(WINDOW *win,
     win->_line[endy].lastchar = win->_line[0].lastchar = endx;
 
     for (i = 0; i <= endy; i++) {
+#if USE_WIDEC_SUPPORT
+       if (endx > 0 && isWidecExt(win->_line[i].text[endx])) {
+           SetChar2(win->_line[i].text[endx - 1], ' ');
+       }
+#endif
        SetChar2(win->_line[i].text[0], wls);
        SetChar2(win->_line[i].text[endx], wrs);
        win->_line[i].firstchar = 0;
        win->_line[i].lastchar = endx;
+#if USE_WIDEC_SUPPORT
+       if (isWidecExt(win->_line[i].text[1])) {
+           SetChar2(win->_line[i].text[1], ' ');
+       }
+#endif
     }
     SetChar2(win->_line[0].text[0], wtl);
     SetChar2(win->_line[0].text[endx], wtr);