mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 12:31:45 +08:00
Merge el_no_echo patch from Festival speech-tools editline fork
This commit is contained in:
parent
83e4837f39
commit
be921400bb
@ -40,6 +40,7 @@ extern int rl_mark;
|
|||||||
extern int rl_end;
|
extern int rl_end;
|
||||||
extern char *rl_line_buffer;
|
extern char *rl_line_buffer;
|
||||||
extern const char *rl_readline_name;
|
extern const char *rl_readline_name;
|
||||||
|
extern int el_no_echo; /* e.g under emacs, don't echo except prompt */
|
||||||
extern void rl_reset_terminal(char *p);
|
extern void rl_reset_terminal(char *p);
|
||||||
extern void rl_initialize(void);
|
extern void rl_initialize(void);
|
||||||
|
|
||||||
|
@ -106,6 +106,7 @@ static char *backspace;
|
|||||||
static int tty_cols;
|
static int tty_cols;
|
||||||
static int tty_rows;
|
static int tty_rows;
|
||||||
|
|
||||||
|
int el_no_echo = 0; /* e.g., under Emacs */
|
||||||
int rl_point;
|
int rl_point;
|
||||||
int rl_mark;
|
int rl_mark;
|
||||||
int rl_end;
|
int rl_end;
|
||||||
@ -133,6 +134,7 @@ static void tty_flush(void)
|
|||||||
ssize_t res;
|
ssize_t res;
|
||||||
|
|
||||||
if (ScreenCount) {
|
if (ScreenCount) {
|
||||||
|
if (!el_no_echo)
|
||||||
res = write (1, Screen, ScreenCount);
|
res = write (1, Screen, ScreenCount);
|
||||||
ScreenCount = 0;
|
ScreenCount = 0;
|
||||||
}
|
}
|
||||||
@ -1052,8 +1054,17 @@ char *readline(const char *prompt)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Prompt = prompt ? prompt : NIL;
|
Prompt = prompt ? prompt : NIL;
|
||||||
|
if (el_no_echo) {
|
||||||
|
int old = el_no_echo;
|
||||||
|
el_no_echo = 0;
|
||||||
tty_puts(Prompt);
|
tty_puts(Prompt);
|
||||||
if ((line = editinput()) != NULL) {
|
tty_flush();
|
||||||
|
el_no_echo = old;
|
||||||
|
} else {
|
||||||
|
tty_puts(Prompt);
|
||||||
|
}
|
||||||
|
line = editinput();
|
||||||
|
if (line) {
|
||||||
line = strdup(line);
|
line = strdup(line);
|
||||||
tty_puts(NEWLINE);
|
tty_puts(NEWLINE);
|
||||||
tty_flush();
|
tty_flush();
|
||||||
|
Loading…
Reference in New Issue
Block a user