couple of DECgraphics optimizations
If a termcap entry for ending attributes and color also contains the code to switch from secondary font back to primary (HE_resets_AS hack), maybe strip the AS code out of HE (and clear the HE_resets_AS flag) when setting up DECgraphics. Affects whether nethack sends extra AS sequences while rendering a run of VT line-drawing chars. My HE doesn't reset AS so that aspect hasn't been exercized. When switching back and forth between normal and line-drawing, defer the switch away from line-drawing if the character will be rendered the same in both character sets (uppercase letter, digit, most punctuation). That might just defer the AE, but could skip it and next AS depending on what characters are written. The cycle might repeat an arbitrary number of times, avoiding sending many AS+AE combinations rather than just one. Both of these optimizations are pretty small but reducing the number of characters sent from a server to a remote user is worthwhile.
This commit is contained in:
@@ -399,6 +399,13 @@ tty_decgraphics_termcap_fixup(void)
|
||||
#if defined(ASCIIGRAPH) && !defined(NO_TERMS)
|
||||
/* some termcaps suffer from the bizarre notion that resetting
|
||||
video attributes should also reset the chosen character set */
|
||||
if (dynamic_HIHE) {
|
||||
(void) strsubst(nh_HE, AE, "");
|
||||
(void) strsubst(nh_HE, ctrlO, "");
|
||||
}
|
||||
/* if AE has prefixing, substituting empty string for it probably
|
||||
didn't work; however, if that _did_ work, we'll be able to
|
||||
avoid HE_resets_AS and the degraded performance it causes */
|
||||
{
|
||||
const char *nh_he = nh_HE, *ae = AE;
|
||||
int he_limit, ae_length;
|
||||
@@ -426,6 +433,16 @@ tty_decgraphics_termcap_fixup(void)
|
||||
++nh_he, --he_limit;
|
||||
}
|
||||
}
|
||||
/* some termcaps have AS load the line-drawing character set as
|
||||
primary instead of having initialization load it as secondary
|
||||
(we've already done that init) and then having AS simply switch
|
||||
to secondary (change to do that now); they also have AE load
|
||||
the US character set, which we avoid by not touching primary
|
||||
[this speedup won't happen if they have delay prefixing though] */
|
||||
if (!strcmp(AS, "\033(0") && !strcmp(AE, "\033(B")) {
|
||||
AS = ctrlN;
|
||||
AE = ctrlO;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* TERMLIB */
|
||||
|
||||
Reference in New Issue
Block a user