]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/comp_expand.c
ncurses 6.2 - patch 20210508
[ncurses.git] / ncurses / tinfo / comp_expand.c
index 02e38e6e3c7a440a3715b8d0010f0209dd852659..09b816954d7471cbbd1aa4e7e4d52334e8b3936a 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
  * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -36,7 +36,7 @@
 #include <ctype.h>
 #include <tic.h>
 
-MODULE_ID("$Id: comp_expand.c,v 1.32 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: comp_expand.c,v 1.33 2021/02/28 00:58:19 tom Exp $")
 
 #if 0
 #define DEBUG_THIS(p) DEBUG(9, p)
@@ -87,7 +87,10 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
              return 0;
     }
 
-    DEBUG_THIS(("_nc_tic_expand %s", _nc_visbuf(srcp)));
+    DEBUG_THIS(("_nc_tic_expand %s:%s:%s",
+               tic_format ? "ti" : "tc",
+               numbers ? "#" : "",
+               _nc_visbuf(srcp)));
     bufp = 0;
     while ((ch = UChar(*str)) != 0) {
        if (ch == '%' && REALPRINT(str + 1)) {
@@ -162,12 +165,12 @@ _nc_tic_expand(const char *srcp, bool tic_format, int numbers)
                                               trailing_spaces(str))) {
            buffer[bufp++] = '\\';
            buffer[bufp++] = 's';
-       } else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) {
+       } else if ((ch == ',' || ch == '^') && tic_format) {
            buffer[bufp++] = '\\';
            buffer[bufp++] = (char) ch;
        } else if (REALPRINT(str)
                   && (ch != ','
-                      && ch != ':'
+                      && !(ch == ':' && !tic_format)
                       && !(ch == '!' && !tic_format)
                       && ch != '^'))
            buffer[bufp++] = (char) ch;