]> granicus.if.org Git - nethack/commitdiff
tty_raw_print_bold() again
authorPatR <rankin@nethack.org>
Tue, 1 Feb 2022 02:31:34 +0000 (18:31 -0800)
committerPatR <rankin@nethack.org>
Tue, 1 Feb 2022 02:31:34 +0000 (18:31 -0800)
Redo the tty handling for raw_print_bold() intended to keep it working
after exit_nhwindows().  Don't assign static addresses to nh_HI and
nh_HE in case the routine to free dynamic termcap data somehow gets
called again.

win/tty/termcap.c

index 9be89d9c73d8d91fa434b4ba4c1268a9c61bb045..231518fb647b10301fb7a6eee813a71be88a54de 100644 (file)
@@ -1375,24 +1375,25 @@ term_end_attr(int attr)
     }
 }
 
+/* this is called 'start bold' but HI is derived from SO (standout) rather
+   than from MD (start bold attribute) */
 void
 term_start_raw_bold(void)
 {
-    if (!nh_HI)
-        nh_HI = tty_standout_on;
+    const char *soOn = nh_HI ? nh_HI : tty_standout_on;
 
-    if (*nh_HI)
-        xputs(nh_HI);
+    if (*soOn)
+        xputs(soOn);
 }
 
+/* this is called 'end bold' but HE is derived from ME (end all attributes) */
 void
 term_end_raw_bold(void)
 {
-    if (!nh_HE)
-        nh_HE = tty_standout_off;
+    const char *soOff = nh_HE ? nh_HE : tty_standout_off;
 
-    if (*nh_HE)
-        xputs(nh_HE);
+    if (*soOff)
+        xputs(soOff);
 }
 
 #ifdef TEXTCOLOR