mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 07:16:23 -05:00
Review echo of input on message line.
This commit is contained in:
parent
910e6576b5
commit
187b0ce4a3
40
display.c
40
display.c
@ -73,6 +73,8 @@ static int taboff = 0 ; /* tab offset for display */
|
|||||||
int mpresf = FALSE ; /* TRUE if message in last line */
|
int mpresf = FALSE ; /* TRUE if message in last line */
|
||||||
int scrollcount = 1 ; /* number of lines to scroll */
|
int scrollcount = 1 ; /* number of lines to scroll */
|
||||||
int discmd = TRUE ; /* display command flag */
|
int discmd = TRUE ; /* display command flag */
|
||||||
|
int disinp = TRUE ; /* display input characters (echo) */
|
||||||
|
|
||||||
|
|
||||||
static int reframe(struct window *wp);
|
static int reframe(struct window *wp);
|
||||||
static void updone(struct window *wp);
|
static void updone(struct window *wp);
|
||||||
@ -1299,6 +1301,18 @@ static void mlputc( char c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* output a string of output characters
|
||||||
|
*
|
||||||
|
* char *s; string to output
|
||||||
|
*/
|
||||||
|
void ostring( char *s) {
|
||||||
|
if( discmd)
|
||||||
|
while( *s)
|
||||||
|
mlputc( *s++ & 0xFF) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write a message into the message line. Keep track of the physical cursor
|
* Write a message into the message line. Keep track of the physical cursor
|
||||||
* position. A small class of printf like format items is handled. Assumes the
|
* position. A small class of printf like format items is handled. Assumes the
|
||||||
@ -1364,6 +1378,8 @@ void vmlwrite( const char *fmt, va_list ap) {
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
mlputc( '%') ;
|
||||||
|
case '%':
|
||||||
mlputc( c) ;
|
mlputc( c) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1539,3 +1555,27 @@ static int newscreensize(int h, int w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* output a character when echo is enabled
|
||||||
|
*
|
||||||
|
* char c ; character to output
|
||||||
|
*/
|
||||||
|
void echoc( char c) {
|
||||||
|
if( disinp)
|
||||||
|
TTputc( c) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* output a string of characters when display input is enabled
|
||||||
|
*
|
||||||
|
* char *s; string to output
|
||||||
|
*/
|
||||||
|
void echos( char *s) {
|
||||||
|
if( disinp)
|
||||||
|
while( *s)
|
||||||
|
TTputc( *s++) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* end of display.c */
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
extern int mpresf ; /* Stuff in message line */
|
extern int mpresf ; /* Stuff in message line */
|
||||||
extern int scrollcount ; /* number of lines to scroll */
|
extern int scrollcount ; /* number of lines to scroll */
|
||||||
extern int discmd ; /* display command flag */
|
extern int discmd ; /* display command flag */
|
||||||
|
extern int disinp ; /* display input characters (echo) */
|
||||||
extern int gfcolor ; /* global forgrnd color (white) */
|
extern int gfcolor ; /* global forgrnd color (white) */
|
||||||
extern int gbcolor ; /* global backgrnd color (black) */
|
extern int gbcolor ; /* global backgrnd color (black) */
|
||||||
|
|
||||||
@ -26,6 +27,9 @@ void movecursor( int row, int col) ;
|
|||||||
void mlerase( void) ;
|
void mlerase( void) ;
|
||||||
void vmlwrite( const char *fmt, va_list ap) ;
|
void vmlwrite( const char *fmt, va_list ap) ;
|
||||||
void mlwrite( const char *fmt, ...) ;
|
void mlwrite( const char *fmt, ...) ;
|
||||||
|
void ostring( char *s) ;
|
||||||
|
void echoc( char c) ;
|
||||||
|
void echos( char *s) ;
|
||||||
void getscreensize( int *widthp, int *heightp) ;
|
void getscreensize( int *widthp, int *heightp) ;
|
||||||
|
|
||||||
#if UNIX
|
#if UNIX
|
||||||
|
2
exec.c
2
exec.c
@ -965,7 +965,7 @@ int execfile( int f, int n) {
|
|||||||
char *fname ; /* name of file to execute */
|
char *fname ; /* name of file to execute */
|
||||||
char *fspec ; /* full file spec */
|
char *fspec ; /* full file spec */
|
||||||
|
|
||||||
status = newmlarg( &fname, "File to execute: ", 0) ;
|
status = newmlarg( &fname, "Execute file: ", 0) ;
|
||||||
if( status != TRUE)
|
if( status != TRUE)
|
||||||
return status ;
|
return status ;
|
||||||
|
|
||||||
|
96
input.c
96
input.c
@ -45,8 +45,6 @@ kbdstate kbdmode = STOP ; /* current keyboard macro mode */
|
|||||||
int lastkey = 0 ; /* last keystoke */
|
int lastkey = 0 ; /* last keystoke */
|
||||||
int kbdrep = 0 ; /* number of repetitions */
|
int kbdrep = 0 ; /* number of repetitions */
|
||||||
|
|
||||||
int disinp = TRUE ; /* display input characters */
|
|
||||||
|
|
||||||
int metac = CONTROL | '[' ; /* current meta character */
|
int metac = CONTROL | '[' ; /* current meta character */
|
||||||
int ctlxc = CONTROL | 'X' ; /* current control X prefix char */
|
int ctlxc = CONTROL | 'X' ; /* current control X prefix char */
|
||||||
int reptc = CONTROL | 'U' ; /* current universal repeat char */
|
int reptc = CONTROL | 'U' ; /* current universal repeat char */
|
||||||
@ -56,7 +54,6 @@ const int nlc = CONTROL | 'J' ; /* end of input char */
|
|||||||
|
|
||||||
static const int quotec = 0x11 ; /* quote char during getstring() */
|
static const int quotec = 0x11 ; /* quote char during getstring() */
|
||||||
|
|
||||||
static void outstring( char *s) ;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ask a yes or no question in the message line. Return either TRUE, FALSE, or
|
* Ask a yes or no question in the message line. Return either TRUE, FALSE, or
|
||||||
@ -164,8 +161,6 @@ int ectoc(int c)
|
|||||||
fn_t getname(void)
|
fn_t getname(void)
|
||||||
{
|
{
|
||||||
int cpos; /* current column on screen output */
|
int cpos; /* current column on screen output */
|
||||||
int c;
|
|
||||||
char *sp; /* pointer to string for output */
|
|
||||||
struct name_bind *ffp; /* first ptr to entry in name binding table */
|
struct name_bind *ffp; /* first ptr to entry in name binding table */
|
||||||
struct name_bind *cffp; /* current ptr to entry in name binding table */
|
struct name_bind *cffp; /* current ptr to entry in name binding table */
|
||||||
struct name_bind *lffp; /* last ptr to entry in name binding table */
|
struct name_bind *lffp; /* last ptr to entry in name binding table */
|
||||||
@ -183,6 +178,8 @@ fn_t getname(void)
|
|||||||
|
|
||||||
/* build a name string from the keyboard */
|
/* build a name string from the keyboard */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
|
int c ;
|
||||||
|
|
||||||
c = tgetc();
|
c = tgetc();
|
||||||
|
|
||||||
/* if we are at the end, just match it */
|
/* if we are at the end, just match it */
|
||||||
@ -199,9 +196,7 @@ fn_t getname(void)
|
|||||||
|
|
||||||
} else if (c == 0x7F || c == 0x08) { /* rubout/erase */
|
} else if (c == 0x7F || c == 0x08) { /* rubout/erase */
|
||||||
if (cpos != 0) {
|
if (cpos != 0) {
|
||||||
TTputc('\b');
|
echos( "\b \b") ;
|
||||||
TTputc(' ');
|
|
||||||
TTputc('\b');
|
|
||||||
--ttcol;
|
--ttcol;
|
||||||
--cpos;
|
--cpos;
|
||||||
TTflush();
|
TTflush();
|
||||||
@ -209,9 +204,7 @@ fn_t getname(void)
|
|||||||
|
|
||||||
} else if (c == 0x15) { /* C-U, kill */
|
} else if (c == 0x15) { /* C-U, kill */
|
||||||
while (cpos != 0) {
|
while (cpos != 0) {
|
||||||
TTputc('\b');
|
echos( "\b \b") ;
|
||||||
TTputc(' ');
|
|
||||||
TTputc('\b');
|
|
||||||
--cpos;
|
--cpos;
|
||||||
--ttcol;
|
--ttcol;
|
||||||
}
|
}
|
||||||
@ -232,9 +225,7 @@ fn_t getname(void)
|
|||||||
(buf, (ffp + 1)->n_name,
|
(buf, (ffp + 1)->n_name,
|
||||||
strlen(buf)) != 0)) {
|
strlen(buf)) != 0)) {
|
||||||
/* no...we match, print it */
|
/* no...we match, print it */
|
||||||
sp = ffp->n_name + cpos;
|
echos( ffp->n_name + cpos) ;
|
||||||
while (*sp)
|
|
||||||
TTputc(*sp++);
|
|
||||||
TTflush();
|
TTflush();
|
||||||
return ffp->n_func;
|
return ffp->n_func;
|
||||||
} else {
|
} else {
|
||||||
@ -278,8 +269,7 @@ fn_t getname(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* add the character */
|
/* add the character */
|
||||||
TTputc(buf
|
echoc( buf[ cpos++]) ;
|
||||||
[cpos++]);
|
|
||||||
}
|
}
|
||||||
/* << << << << << << << << << << << << << << << << << */
|
/* << << << << << << << << << << << << << << << << << */
|
||||||
}
|
}
|
||||||
@ -295,7 +285,7 @@ fn_t getname(void)
|
|||||||
} else {
|
} else {
|
||||||
if (cpos < NSTRING - 1 && c > ' ') {
|
if (cpos < NSTRING - 1 && c > ' ') {
|
||||||
buf[cpos++] = c;
|
buf[cpos++] = c;
|
||||||
TTputc(c);
|
echoc( c) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
++ttcol;
|
++ttcol;
|
||||||
@ -529,12 +519,9 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
static char tmp[] = "/tmp/meXXXXXX";
|
static char tmp[] = "/tmp/meXXXXXX";
|
||||||
FILE *tmpf = NULL;
|
FILE *tmpf = NULL;
|
||||||
#endif
|
#endif
|
||||||
ffile = (strcmp(prompt, "Find file: ") == 0
|
/* Look for "Find file: ", "View file: ", "Insert file: ", "Write file: ",
|
||||||
|| strcmp(prompt, "View file: ") == 0
|
** "Read file: ", "Execute file: " */
|
||||||
|| strcmp(prompt, "Insert file: ") == 0
|
ffile = NULL != strstr( prompt, " file: ") ;
|
||||||
|| strcmp(prompt, "Write file: ") == 0
|
|
||||||
|| strcmp(prompt, "Read file: ") == 0
|
|
||||||
|| strcmp(prompt, "File to execute: ") == 0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cpos = 0;
|
cpos = 0;
|
||||||
@ -596,15 +583,15 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
} else if ((c == 0x7F || c == 0x08) && quotef == FALSE) {
|
} else if ((c == 0x7F || c == 0x08) && quotef == FALSE) {
|
||||||
/* rubout/erase */
|
/* rubout/erase */
|
||||||
if (cpos != 0) {
|
if (cpos != 0) {
|
||||||
outstring("\b \b");
|
echos("\b \b");
|
||||||
--ttcol;
|
--ttcol;
|
||||||
|
|
||||||
if (buf[--cpos] < 0x20) {
|
if (buf[--cpos] < 0x20) {
|
||||||
outstring("\b \b");
|
echos("\b \b");
|
||||||
--ttcol;
|
--ttcol;
|
||||||
}
|
}
|
||||||
if (buf[cpos] == '\n') {
|
if (buf[cpos] == '\n') {
|
||||||
outstring("\b\b \b\b");
|
echos("\b\b \b\b");
|
||||||
ttcol -= 2;
|
ttcol -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,15 +601,15 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
} else if (c == 0x15 && quotef == FALSE) {
|
} else if (c == 0x15 && quotef == FALSE) {
|
||||||
/* C-U, kill */
|
/* C-U, kill */
|
||||||
while (cpos != 0) {
|
while (cpos != 0) {
|
||||||
outstring("\b \b");
|
echos("\b \b");
|
||||||
--ttcol;
|
--ttcol;
|
||||||
|
|
||||||
if (buf[--cpos] < 0x20) {
|
if (buf[--cpos] < 0x20) {
|
||||||
outstring("\b \b");
|
echos("\b \b");
|
||||||
--ttcol;
|
--ttcol;
|
||||||
}
|
}
|
||||||
if (buf[cpos] == '\n') {
|
if (buf[cpos] == '\n') {
|
||||||
outstring("\b\b \b\b");
|
echos("\b\b \b\b");
|
||||||
ttcol -= 2;
|
ttcol -= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -642,15 +629,15 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
didtry = 1;
|
didtry = 1;
|
||||||
ocpos = cpos;
|
ocpos = cpos;
|
||||||
while (cpos != 0) {
|
while (cpos != 0) {
|
||||||
outstring("\b \b");
|
echos("\b \b");
|
||||||
--ttcol;
|
--ttcol;
|
||||||
|
|
||||||
if (buf[--cpos] < 0x20) {
|
if (buf[--cpos] < 0x20) {
|
||||||
outstring("\b \b");
|
echos("\b \b");
|
||||||
--ttcol;
|
--ttcol;
|
||||||
}
|
}
|
||||||
if (buf[cpos] == '\n') {
|
if (buf[cpos] == '\n') {
|
||||||
outstring("\b\b \b\b");
|
echos("\b\b \b\b");
|
||||||
ttcol -= 2;
|
ttcol -= 2;
|
||||||
}
|
}
|
||||||
if (buf[cpos] == '*' || buf[cpos] == '?')
|
if (buf[cpos] == '*' || buf[cpos] == '?')
|
||||||
@ -737,16 +724,15 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
for (n = 0; n < cpos; n++) {
|
for (n = 0; n < cpos; n++) {
|
||||||
c = buf[n];
|
c = buf[n];
|
||||||
if ((c < ' ') && (c != '\n')) {
|
if ((c < ' ') && (c != '\n')) {
|
||||||
outstring("^");
|
echos("^");
|
||||||
++ttcol;
|
++ttcol;
|
||||||
c ^= 0x40;
|
c ^= 0x40;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != '\n') {
|
if( c != '\n')
|
||||||
if (disinp)
|
echoc( c) ;
|
||||||
TTputc(c);
|
else { /* put out <NL> for <ret> */
|
||||||
} else { /* put out <NL> for <ret> */
|
echos("<NL>");
|
||||||
outstring("<NL>");
|
|
||||||
ttcol += 3;
|
ttcol += 3;
|
||||||
}
|
}
|
||||||
++ttcol;
|
++ttcol;
|
||||||
@ -765,16 +751,15 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
buf[cpos++] = c;
|
buf[cpos++] = c;
|
||||||
|
|
||||||
if ((c < ' ') && (c != '\n')) {
|
if ((c < ' ') && (c != '\n')) {
|
||||||
outstring("^");
|
echos("^");
|
||||||
++ttcol;
|
++ttcol;
|
||||||
c ^= 0x40;
|
c ^= 0x40;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != '\n') {
|
if( c != '\n')
|
||||||
if (disinp)
|
echoc( c) ;
|
||||||
TTputc(c);
|
else { /* put out <NL> for <ret> */
|
||||||
} else { /* put out <NL> for <ret> */
|
echos("<NL>");
|
||||||
outstring("<NL>");
|
|
||||||
ttcol += 3;
|
ttcol += 3;
|
||||||
}
|
}
|
||||||
++ttcol;
|
++ttcol;
|
||||||
@ -783,26 +768,3 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* output a string of characters when display input is enabled
|
|
||||||
*
|
|
||||||
* char *s; string to output
|
|
||||||
*/
|
|
||||||
static void outstring( char *s) {
|
|
||||||
if( disinp)
|
|
||||||
while( *s)
|
|
||||||
TTputc( *s++) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* output a string of output characters
|
|
||||||
*
|
|
||||||
* char *s; string to output
|
|
||||||
*/
|
|
||||||
void ostring( char *s)
|
|
||||||
{
|
|
||||||
if (discmd)
|
|
||||||
while (*s)
|
|
||||||
TTputc( *s++ & 0xFF) ;
|
|
||||||
}
|
|
||||||
|
2
input.h
2
input.h
@ -13,7 +13,6 @@ extern int kbdrep ; /* number of repetitions */
|
|||||||
extern int kbdm[] ; /* Holds kayboard macro data */
|
extern int kbdm[] ; /* Holds kayboard macro data */
|
||||||
extern int *kbdptr ; /* current position in keyboard buf */
|
extern int *kbdptr ; /* current position in keyboard buf */
|
||||||
extern int *kbdend ; /* ptr to end of the keyboard */
|
extern int *kbdend ; /* ptr to end of the keyboard */
|
||||||
extern int disinp ; /* display input characters */
|
|
||||||
|
|
||||||
extern int metac; /* current meta character */
|
extern int metac; /* current meta character */
|
||||||
extern int ctlxc; /* current control X prefix char */
|
extern int ctlxc; /* current control X prefix char */
|
||||||
@ -31,6 +30,5 @@ int tgetc( void) ;
|
|||||||
int get1key( void) ;
|
int get1key( void) ;
|
||||||
int getcmd( void) ;
|
int getcmd( void) ;
|
||||||
int getstring( const char *prompt, char *buf, int nbuf, int eolchar) ;
|
int getstring( const char *prompt, char *buf, int nbuf, int eolchar) ;
|
||||||
void ostring( char *s) ;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user