make recent autocomplete changes conditional
- there are problems with the changes on at least the win32 tty port.
This commit is contained in:
@@ -59,6 +59,9 @@ getlin_hook_proc hook;
|
|||||||
Sprintf(toplines, "%s ", query);
|
Sprintf(toplines, "%s ", query);
|
||||||
Strcat(toplines, obufp);
|
Strcat(toplines, obufp);
|
||||||
if((c = Getchar()) == EOF) {
|
if((c = Getchar()) == EOF) {
|
||||||
|
#ifndef NEWAUTOCOMP
|
||||||
|
*bufp = 0;
|
||||||
|
#endif /* not NEWAUTOCOMP */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(c == '\033') {
|
if(c == '\033') {
|
||||||
@@ -100,32 +103,46 @@ getlin_hook_proc hook;
|
|||||||
}
|
}
|
||||||
if(c == erase_char || c == '\b') {
|
if(c == erase_char || c == '\b') {
|
||||||
if(bufp != obufp) {
|
if(bufp != obufp) {
|
||||||
|
#ifdef NEWAUTOCOMP
|
||||||
char *i;
|
char *i;
|
||||||
|
|
||||||
|
#endif /* NEWAUTOCOMP */
|
||||||
bufp--;
|
bufp--;
|
||||||
|
#ifndef NEWAUTOCOMP
|
||||||
|
putsyms("\b \b");/* putsym converts \b */
|
||||||
|
#else /* NEWAUTOCOMP */
|
||||||
putsyms("\b");
|
putsyms("\b");
|
||||||
for (i = bufp; *i; ++i) putsyms(" ");
|
for (i = bufp; *i; ++i) putsyms(" ");
|
||||||
for (; i > bufp; --i) putsyms("\b");
|
for (; i > bufp; --i) putsyms("\b");
|
||||||
*bufp = 0;
|
*bufp = 0;
|
||||||
|
#endif /* NEWAUTOCOMP */
|
||||||
} else tty_nhbell();
|
} else tty_nhbell();
|
||||||
#if defined(apollo)
|
#if defined(apollo)
|
||||||
} else if(c == '\n' || c == '\r') {
|
} else if(c == '\n' || c == '\r') {
|
||||||
#else
|
#else
|
||||||
} else if(c == '\n') {
|
} else if(c == '\n') {
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NEWAUTOCOMP
|
||||||
|
*bufp = 0;
|
||||||
|
#endif /* not NEWAUTOCOMP */
|
||||||
break;
|
break;
|
||||||
} else if(' ' <= (unsigned char) c && c != '\177' &&
|
} else if(' ' <= (unsigned char) c && c != '\177' &&
|
||||||
(bufp-obufp < BUFSZ-1 && bufp-obufp < COLNO)) {
|
(bufp-obufp < BUFSZ-1 && bufp-obufp < COLNO)) {
|
||||||
/* avoid isprint() - some people don't have it
|
/* avoid isprint() - some people don't have it
|
||||||
' ' is not always a printing char */
|
' ' is not always a printing char */
|
||||||
|
#ifdef NEWAUTOCOMP
|
||||||
char *i = eos(bufp);
|
char *i = eos(bufp);
|
||||||
|
|
||||||
|
#endif /* NEWAUTOCOMP */
|
||||||
*bufp = c;
|
*bufp = c;
|
||||||
bufp[1] = 0;
|
bufp[1] = 0;
|
||||||
putsyms(bufp);
|
putsyms(bufp);
|
||||||
bufp++;
|
bufp++;
|
||||||
if (hook && (*hook)(obufp)) {
|
if (hook && (*hook)(obufp)) {
|
||||||
putsyms(bufp);
|
putsyms(bufp);
|
||||||
|
#ifndef NEWAUTOCOMP
|
||||||
|
bufp = eos(bufp);
|
||||||
|
#else /* NEWAUTOCOMP */
|
||||||
/* pointer and cursor left where they were */
|
/* pointer and cursor left where they were */
|
||||||
for (i = bufp; *i; ++i) putsyms("\b");
|
for (i = bufp; *i; ++i) putsyms("\b");
|
||||||
} else if (i > bufp) {
|
} else if (i > bufp) {
|
||||||
@@ -134,12 +151,20 @@ getlin_hook_proc hook;
|
|||||||
/* erase rest of prior guess */
|
/* erase rest of prior guess */
|
||||||
for (; i > bufp; --i) putsyms(" ");
|
for (; i > bufp; --i) putsyms(" ");
|
||||||
for (; s > bufp; --s) putsyms("\b");
|
for (; s > bufp; --s) putsyms("\b");
|
||||||
|
#endif /* NEWAUTOCOMP */
|
||||||
}
|
}
|
||||||
} else if(c == kill_char || c == '\177') { /* Robert Viduya */
|
} else if(c == kill_char || c == '\177') { /* Robert Viduya */
|
||||||
/* this test last - @ might be the kill_char */
|
/* this test last - @ might be the kill_char */
|
||||||
|
#ifndef NEWAUTOCOMP
|
||||||
|
while(bufp != obufp) {
|
||||||
|
bufp--;
|
||||||
|
putsyms("\b \b");
|
||||||
|
}
|
||||||
|
#else /* NEWAUTOCOMP */
|
||||||
for (; *bufp; ++bufp) putsyms(" ");
|
for (; *bufp; ++bufp) putsyms(" ");
|
||||||
for (; bufp != obufp; --bufp) putsyms("\b \b");
|
for (; bufp != obufp; --bufp) putsyms("\b \b");
|
||||||
*bufp = 0;
|
*bufp = 0;
|
||||||
|
#endif /* NEWAUTOCOMP */
|
||||||
} else
|
} else
|
||||||
tty_nhbell();
|
tty_nhbell();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user