mirror of
				https://github.com/troglobit/editline.git
				synced 2025-11-04 11:18:07 +08:00 
			
		
		
		
	Merge el_no_echo patch from Festival speech-tools editline fork
This commit is contained in:
		@@ -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();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user