Date: Sun, 21 Dec 1997 14:01:44 +0200 (IST) From: Eli Zaretskii To: Nate Eldredge cc: djgpp AT delorie DOT com Subject: Re: Emacs bug: Doesn't restore display settings In-Reply-To: <199712201834.KAA17092@adit.ap.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Sat, 20 Dec 1997, Nate Eldredge wrote: > There is a minor bug in Emacs. Apparently it changes the display attributes > so that text with the `blink' bit set ends up with an intense background > instead. This is all fine, but it doesn't change it back when it finishes. This was fixed a long time ago. Are you using the original Emacs binary from em1934b.zip distributed about a year ago? If so, get the latest binary from SimTel.NET, it shouldn't have this problem. If you have Emacs sources on your machine, here's the source-level patch that fixed this for me: *** src/msdos.c~5 Mon Dec 23 18:15:20 1996 --- src/msdos.c Mon Jan 6 19:19:18 1997 *************** Boston, MA 02111-1307, USA. */ *** 62,67 **** --- 62,71 ---- #define _USE_LFN 0 #endif + #ifndef _dos_ds + #define _dos_ds _go32_info_block.selector_for_linear_memory + #endif + #if __DJGPP__ > 1 #include *************** ScreenVisualBell (void) *** 370,386 **** --- 374,412 ---- #ifndef HAVE_X_WINDOWS + static int blink_bit = -1; /* the state of the blink bit at startup */ + /* Enable bright background colors. */ static void bright_bg (void) { union REGS regs; + /* Remember the original state of the blink/bright-background bit. + It is stored at 0040:0065h in the BIOS data area. */ + if (blink_bit == -1) + blink_bit = (_farpeekb (_dos_ds, 0x465) & 0x20) == 0x20; + regs.h.bl = 0; regs.x.ax = 0x1003; int86 (0x10, ®s, ®s); } + /* Disable bright background colors (and enable blinking) if we found + the video system in that state at startup. */ + static void + maybe_enable_blinking (void) + { + if (blink_bit == 1) + { + union REGS regs; + + regs.h.bl = 1; + regs.x.ax = 0x1003; + int86 (0x10, ®s, ®s); + } + } + /* Set the screen dimensions so that it can show no less than ROWS x COLS frame. */ *************** IT_reset_terminal_modes (void) *** 868,873 **** --- 894,903 ---- return; mouse_off (); + + /* Leave the video system in the same state as we found it, + as far as the blink/bright-background bit is concerned. */ + maybe_enable_blinking (); /* We have a situation here. We cannot just do ScreenUpdate(startup_screen_buffer) because *************** run_msdos_command (argv, dir, tempin, te *** 3009,3014 **** --- 3039,3049 ---- mouse_init (); mouse_moveto (x, y); } + + /* Some programs might change the meaning of the highest bit of the + text attribute byte, so we get blinking characters instead of the + bright background colors. Restore that. */ + bright_bg (); done: chdir (oldwd);