- char *oldsgr = set_attributes;
- char *oldacsc = acs_chars;
- set_attributes = ABSENT_STRING;
- SHOW_WHY("# (sgr removed to fit entry within %d bytes)\n",
- critlen);
- if ((len = FMT_ENTRY()) > critlen) {
- acs_chars = ABSENT_STRING;
- SHOW_WHY("# (acsc removed to fit entry within %d bytes)\n",
+ bool changed = FALSE;
+
+#if NCURSES_XNAMES
+ /*
+ * Extended names are most likely function-key definitions. Drop
+ * those first.
+ */
+ unsigned n;
+ for (n = STRCOUNT; n < NUM_STRINGS(tterm); n++) {
+ const char *name = ExtStrname(tterm, n, strnames);
+
+ if (VALID_STRING(tterm->Strings[n])) {
+ set_attributes = ABSENT_STRING;
+ /* we remove long names anyway - only report the short */
+ if (strlen(name) <= 2) {
+ SHOW_WHY("# (%s removed to fit entry within %d bytes)\n",
+ name,
+ critlen);
+ }
+ changed = TRUE;
+ if ((len = FMT_ENTRY()) <= critlen)
+ break;
+ }
+ }
+#endif
+ if (VALID_STRING(set_attributes)) {
+ set_attributes = ABSENT_STRING;
+ SHOW_WHY("# (sgr removed to fit entry within %d bytes)\n",