From 5127800475f05ad9923ddb511079a44e05e076a6 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Mon, 23 Dec 2002 12:49:56 +0000 Subject: [PATCH] autocomplete fix for win32 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 | 4 ---- win/tty/getline.c | 4 ++++ win/tty/wintty.c | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index abc5597c3..e73bb4eb5 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -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 diff --git a/win/tty/getline.c b/win/tty/getline.c index cd0dae225..fded0d3b4 100644 --- a/win/tty/getline.c +++ b/win/tty/getline.c @@ -6,6 +6,10 @@ #ifdef TTY_GRAPHICS +#if !defined(MSDOS) && !defined(MAC) +#define NEWAUTOCOMP +#endif + #include "wintty.h" #include "func_tab.h" diff --git a/win/tty/wintty.c b/win/tty/wintty.c index a08028887..ce9311e50 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -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) {