]> granicus.if.org Git - nethack/commitdiff
autocomplete fix for win32
authornethack.allison <nethack.allison>
Mon, 23 Dec 2002 12:49:56 +0000 (12:49 +0000)
committernethack.allison <nethack.allison>
Mon, 23 Dec 2002 12:49:56 +0000 (12:49 +0000)
The problem with the new autocomplete was tracked down to
be the result of differences between different implementations
of backsp().  The differences go all the way back to the
early MSDOS port by the look of it, and the win32,
and Mac tty ports all seemed to pattern themselves after the
MSDOS port for that routine.  Apparently, it didn't cause any
harm until now.

The problem is that backsp() sends a character sequence
of 0x08, 0x20, 0x08 on at least those ports, where the Unix
tty code only sends 0x08.  So the characters in the new
autocomplete were all being erased from the screen.

This patch only fixes the win32 tty port, so I've left the
conditional code in getline.c for DOS and Mac. I

sys/winnt/nttty.c
win/tty/getline.c
win/tty/wintty.c

index abc5597c3ef7bd30c30d221bef6dd664164df623..e73bb4eb5f9b26e1e7b503c1bc3b820608fcfe8a 100644 (file)
@@ -625,8 +625,6 @@ home()
 void
 backsp()
 {
-       DWORD count;
-
        GetConsoleScreenBufferInfo(hConOut,&csbi);
        if (csbi.dwCursorPosition.X > 0)
                ntcoord.X = csbi.dwCursorPosition.X-1;
@@ -638,8 +636,6 @@ backsp()
                                (currentcolor|currenthilite|currentbackground));
                colorchange = FALSE;
        }
-       WriteConsole(hConOut," ",1,&count,0);
-       SetConsoleCursorPosition(hConOut,ntcoord);      
 }
 
 void
index cd0dae2254200ebbc338082a84e9953127149f09..fded0d3b4caccd129f76d6302ebd5ef0ca885dde 100644 (file)
@@ -6,6 +6,10 @@
 
 #ifdef TTY_GRAPHICS
 
+#if !defined(MSDOS) && !defined(MAC)
+#define NEWAUTOCOMP
+#endif
+
 #include "wintty.h"
 #include "func_tab.h"
 
index a0802888733d65e157fb983117cb43c258fab934..ce9311e50d8c25bfe812875eff5757dd930043c9 100644 (file)
@@ -688,6 +688,8 @@ tty_askname()
 #if defined(MICRO) || defined(WIN32CON)
 # if defined(WIN32CON)
                                backsp();       /* \b is visible on NT */
+                               (void) putchar(' ');
+                               backsp();
 # else
 #  if defined(MSDOS)
                                if (iflags.grmode) {