]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tty/tty_update.c
ncurses 6.4 - patch 20240420
[ncurses.git] / ncurses / tty / tty_update.c
index bdd673bec0c8e601182c5825f120b15dfeb2ee18..0427024cb084988428c56bad1805dbf37a99ae78 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright 2018-2020,2021 Thomas E. Dickey                                *
+ * Copyright 2018-2023,2024 Thomas E. Dickey                                *
  * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -85,7 +85,7 @@
 
 #include <ctype.h>
 
 
 #include <ctype.h>
 
-MODULE_ID("$Id: tty_update.c,v 1.312 2021/09/04 10:29:59 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.316 2024/02/04 00:09:34 tom Exp $")
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
@@ -256,6 +256,7 @@ PutAttrChar(NCURSES_SP_DCLx CARG_CH_T ch)
         *    not checked.
         */
        if (is8bits(CharOf(CHDEREF(ch)))
         *    not checked.
         */
        if (is8bits(CharOf(CHDEREF(ch)))
+           && (!is7bits(CharOf(CHDEREF(ch))) && _nc_unicode_locale())
            && (isprint(CharOf(CHDEREF(ch)))
                || (SP_PARM->_legacy_coding > 0 && CharOf(CHDEREF(ch)) >= 160)
                || (SP_PARM->_legacy_coding > 1 && CharOf(CHDEREF(ch)) >= 128)
            && (isprint(CharOf(CHDEREF(ch)))
                || (SP_PARM->_legacy_coding > 0 && CharOf(CHDEREF(ch)) >= 160)
                || (SP_PARM->_legacy_coding > 1 && CharOf(CHDEREF(ch)) >= 128)
@@ -757,14 +758,20 @@ TINFO_DOUPDATE(NCURSES_SP_DCL0)
      * We do not allow applications to assign new values in the reentrant
      * model.
      */
      * We do not allow applications to assign new values in the reentrant
      * model.
      */
+#if NCURSES_SP_FUNCS
+    if (SP_PARM == CURRENT_SCREEN) {
+#endif
 #define SyncScreens(internal,exported) \
        if (internal == 0) internal = exported; \
        if (internal != exported) exported = internal
 
 #define SyncScreens(internal,exported) \
        if (internal == 0) internal = exported; \
        if (internal != exported) exported = internal
 
-    SyncScreens(CurScreen(SP_PARM), curscr);
-    SyncScreens(NewScreen(SP_PARM), newscr);
-    SyncScreens(StdScreen(SP_PARM), stdscr);
+       SyncScreens(CurScreen(SP_PARM), curscr);
+       SyncScreens(NewScreen(SP_PARM), newscr);
+       SyncScreens(StdScreen(SP_PARM), stdscr);
+#if NCURSES_SP_FUNCS
+    }
 #endif
 #endif
+#endif /* !USE_REENTRANT */
 
     if (CurScreen(SP_PARM) == 0
        || NewScreen(SP_PARM) == 0
 
     if (CurScreen(SP_PARM) == 0
        || NewScreen(SP_PARM) == 0
@@ -998,7 +1005,7 @@ TINFO_DOUPDATE(NCURSES_SP_DCL0)
        if (check_pending(NCURSES_SP_ARG))
            goto cleanup;
 
        if (check_pending(NCURSES_SP_ARG))
            goto cleanup;
 
-       nonempty = min(screen_lines(SP_PARM), NewScreen(SP_PARM)->_maxy + 1);
+       nonempty = Min(screen_lines(SP_PARM), NewScreen(SP_PARM)->_maxy + 1);
 
        if (SP_PARM->_scrolling) {
            NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_ARG);
 
        if (SP_PARM->_scrolling) {
            NCURSES_SP_NAME(_nc_scroll_optimize) (NCURSES_SP_ARG);
@@ -1128,7 +1135,7 @@ ClrUpdate(NCURSES_SP_DCL0)
     if (0 != SP_PARM) {
        int i;
        NCURSES_CH_T blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM));
     if (0 != SP_PARM) {
        int i;
        NCURSES_CH_T blank = ClrBlank(NCURSES_SP_ARGx StdScreen(SP_PARM));
-       int nonempty = min(screen_lines(SP_PARM),
+       int nonempty = Min(screen_lines(SP_PARM),
                           NewScreen(SP_PARM)->_maxy + 1);
 
        ClearScreen(NCURSES_SP_ARGx blank);
                           NewScreen(SP_PARM)->_maxy + 1);
 
        ClearScreen(NCURSES_SP_ARGx blank);
@@ -1227,7 +1234,7 @@ static int
 ClrBottom(NCURSES_SP_DCLx int total)
 {
     int top = total;
 ClrBottom(NCURSES_SP_DCLx int total)
 {
     int top = total;
-    int last = min(screen_columns(SP_PARM), NewScreen(SP_PARM)->_maxx + 1);
+    int last = Min(screen_columns(SP_PARM), NewScreen(SP_PARM)->_maxx + 1);
     NCURSES_CH_T blank = NewScreen(SP_PARM)->_line[total - 1].text[last - 1];
 
     if (clr_eos && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) {
     NCURSES_CH_T blank = NewScreen(SP_PARM)->_line[total - 1].text[last - 1];
 
     if (clr_eos && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) {
@@ -1287,7 +1294,7 @@ ClrBottom(NCURSES_SP_DCLx int total)
 **             nLastChar = position of last different character in new line
 **
 **             move to firstChar
 **             nLastChar = position of last different character in new line
 **
 **             move to firstChar
-**             overwrite chars up to min(oLastChar, nLastChar)
+**             overwrite chars up to Min(oLastChar, nLastChar)
 **             if oLastChar < nLastChar
 **                     insert newLine[oLastChar+1..nLastChar]
 **             else
 **             if oLastChar < nLastChar
 **                     insert newLine[oLastChar+1..nLastChar]
 **             else
@@ -1525,7 +1532,7 @@ TransformLine(NCURSES_SP_DCLx int const lineno)
                }
                ClrToEOL(NCURSES_SP_ARGx blank, FALSE);
            } else {
                }
                ClrToEOL(NCURSES_SP_ARGx blank, FALSE);
            } else {
-               n = max(nLastChar, oLastChar);
+               n = Max(nLastChar, oLastChar);
                PutRange(NCURSES_SP_ARGx
                         oldLine,
                         newLine,
                PutRange(NCURSES_SP_ARGx
                         oldLine,
                         newLine,
@@ -1550,7 +1557,7 @@ TransformLine(NCURSES_SP_DCLx int const lineno)
                    break;
            }
 
                    break;
            }
 
-           n = min(oLastChar, nLastChar);
+           n = Min(oLastChar, nLastChar);
            if (n >= firstChar) {
                GoTo(NCURSES_SP_ARGx lineno, firstChar);
                PutRange(NCURSES_SP_ARGx
            if (n >= firstChar) {
                GoTo(NCURSES_SP_ARGx lineno, firstChar);
                PutRange(NCURSES_SP_ARGx
@@ -1562,7 +1569,7 @@ TransformLine(NCURSES_SP_DCLx int const lineno)
            }
 
            if (oLastChar < nLastChar) {
            }
 
            if (oLastChar < nLastChar) {
-               int m = max(nLastNonblank, oLastNonblank);
+               int m = Max(nLastNonblank, oLastNonblank);
 #if USE_WIDEC_SUPPORT
                if (n) {
                    while (isWidecExt(newLine[n + 1]) && n) {
 #if USE_WIDEC_SUPPORT
                if (n) {
                    while (isWidecExt(newLine[n + 1]) && n) {