undo recent DECgraphics optimizations

Unresolved display issues with rxvt-unicode after the optimizations
dealing with switching between DECgraphics line-drawing character set
and normal character set.

Effectively comment them out rather than revert the commits.
This commit is contained in:
PatR
2024-03-31 15:49:16 -07:00
parent 7f12c7e0e6
commit dddfd66e7a
2 changed files with 33 additions and 19 deletions

View File

@@ -7,6 +7,9 @@
#if defined(TTY_GRAPHICS) && !defined(NO_TERMS) #if defined(TTY_GRAPHICS) && !defined(NO_TERMS)
/* leave this undefined; it produces bad screen output with rxvt-unicode */
/*#define DECgraphicsOptimization*/
#include "wintty.h" #include "wintty.h"
#include "tcap.h" #include "tcap.h"
@@ -395,15 +398,15 @@ tty_decgraphics_termcap_fixup(void)
#ifdef PC9800 #ifdef PC9800
init_hilite(); init_hilite();
#endif #endif
if (nh_HE && *nh_HE)
xputs(nh_HE); /* turn off any active highlighting (before maybe
* changing HE or AE) */
#if defined(ASCIIGRAPH) && !defined(NO_TERMS) #if defined(ASCIIGRAPH) && !defined(NO_TERMS)
#if DECgraphicsOptimization
/* some termcaps suffer from the bizarre notion that resetting /* some termcaps suffer from the bizarre notion that resetting
video attributes should also reset the chosen character set */ video attributes should also reset the chosen character set */
if (dynamic_HIHE) { if (dynamic_HIHE) {
assert(nh_HE != NULL); assert(nh_HE != NULL);
xputs(nh_HE); /* turn off any active highlighting (before maybe
* changing HE or AE) */
(void) strsubst(nh_HE, AE, ""); (void) strsubst(nh_HE, AE, "");
(void) strsubst(nh_HE, ctrlO, ""); (void) strsubst(nh_HE, ctrlO, "");
/* if AE has prefixing, substituting an empty string for it in HE /* if AE has prefixing, substituting an empty string for it in HE
@@ -413,29 +416,32 @@ tty_decgraphics_termcap_fixup(void)
(void) strsubst(nh_HE, "\033(B", ""); (void) strsubst(nh_HE, "\033(B", "");
(void) strsubst(nh_HE, "\033(A", ""); (void) strsubst(nh_HE, "\033(A", "");
} }
#endif
/* if AE is still present in HE, set a flag so that glyph writing /* if AE is still present in HE, set a flag so that glyph writing
code will know that AS needs to be refreshed for consecutive code will know that AS needs to be refreshed for consecutive
line drawing characters */ line drawing characters */
if (nh_HE && *nh_HE) { const char *ae = AE;
const char *ae = AE;
if (digit(*ae)) { /* skip over delay prefix, if any */ if (digit(*ae)) { /* skip over delay prefix, if any */
do do
++ae; ++ae;
while (digit(*ae)); while (digit(*ae));
if (*ae == '.') { if (*ae == '.') {
++ae; ++ae;
if (digit(*ae)) if (digit(*ae))
++ae;
}
if (*ae == '*')
++ae; ++ae;
} }
if (strstr(nh_HE, ae)) /* stdc strstr(), not nethack's strstri() */ if (*ae == '*')
HE_resets_AS = TRUE; ++ae;
} }
/* stdc strstr(), not nethack's strstri(); HE ends color, ME ends
inverse video; they might have the same value; sequences to end
other attributes aren't known to sometimes contain AE */
if ((nh_HE && strstr(nh_HE, ae)) || (ME && strstr(ME, ae)))
HE_resets_AS = TRUE;
#ifdef DECgraphicsOptimization
/* some termcaps have AS load the line-drawing character set as /* some termcaps have AS load the line-drawing character set as
primary instead of having initialization load it as secondary primary instead of having initialization load it as secondary
(we've already done that init) and then having AS simply switch (we've already done that init) and then having AS simply switch
@@ -450,8 +456,9 @@ tty_decgraphics_termcap_fixup(void)
AS = ctrlN; AS = ctrlN;
AE = ctrlO; AE = ctrlO;
} }
#endif #endif /* DECgraphicsOptimization */
xputs(AE); xputs(AE);
#endif /* ASCIIGRAPH && !NO_TERMS */
} }
#endif /* TERMLIB */ #endif /* TERMLIB */

View File

@@ -17,6 +17,9 @@
#ifdef TTY_GRAPHICS #ifdef TTY_GRAPHICS
#include "dlb.h" #include "dlb.h"
/* leave this undefined; it produces bad screen output with rxvt-unicode */
/*#define DECgraphicsOptimization*/
#ifdef MAC #ifdef MAC
#define MICRO /* The Mac is a MICRO only for this file, not in general! */ #define MICRO /* The Mac is a MICRO only for this file, not in general! */
#ifdef THINK_C #ifdef THINK_C
@@ -3709,12 +3712,16 @@ g_putch(int in_ch)
} }
(void) putchar((ch ^ 0x80)); /* Strip 8th bit */ (void) putchar((ch ^ 0x80)); /* Strip 8th bit */
} else { } else {
if (GFlag
#ifdef DECgraphicsOptimization
/* for DECgraphics, we only need to switch back from the line /* for DECgraphics, we only need to switch back from the line
drawing character set to the normal one if 'ch' is a lowercase drawing character set to the normal one if 'ch' is a lowercase
letter or one of a handful of punctuation characters (the letter or one of a handful of punctuation characters (the
range is contiguous but somewhat odd); deferring graph_off() range is contiguous but somewhat odd); deferring graph_off()
now might allow skipping both it and next potential graph_on() */ now might allow skipping both it and next potential graph_on() */
if (GFlag && ch >= 0x5f && ch <= 0x7e) { && ch >= 0x5f && ch <= 0x7e
#endif
) {
graph_off(); graph_off();
GFlag = FALSE; GFlag = FALSE;
} }