Only FLUSH if we are ending libedit; DRAIN if we suspend for readline.

This allows pasting multiline buffers (Gerry Swislow)
This commit is contained in:
christos 2018-01-01 22:32:46 +00:00
parent ccde5fbf0d
commit ff1a7c8cc8
4 changed files with 14 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: el.c,v 1.95 2017/09/05 18:07:59 christos Exp $ */
/* $NetBSD: el.c,v 1.96 2018/01/01 22:32:46 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
__RCSID("$NetBSD: el.c,v 1.95 2017/09/05 18:07:59 christos Exp $");
__RCSID("$NetBSD: el.c,v 1.96 2018/01/01 22:32:46 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -146,7 +146,7 @@ el_end(EditLine *el)
keymacro_end(el);
map_end(el);
if (!(el->el_flags & NO_TTY))
tty_end(el);
tty_end(el, TCSAFLUSH);
ch_end(el);
read_end(el->el_read);
search_end(el);

View File

@ -1,4 +1,4 @@
/* $NetBSD: readline.c,v 1.145 2017/12/08 16:56:23 christos Exp $ */
/* $NetBSD: readline.c,v 1.146 2018/01/01 22:32:46 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
__RCSID("$NetBSD: readline.c,v 1.145 2017/12/08 16:56:23 christos Exp $");
__RCSID("$NetBSD: readline.c,v 1.146 2018/01/01 22:32:46 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@ -388,7 +388,7 @@ rl_initialize(void)
_resize_fun(e, &rl_line_buffer);
_rl_update_pos();
tty_end(e);
tty_end(e, TCSADRAIN);
return 0;
}
@ -460,7 +460,7 @@ readline(const char *p)
history_length = ev.num;
out:
tty_end(e);
tty_end(e, TCSADRAIN);
return buf;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.66 2017/09/05 18:07:59 christos Exp $ */
/* $NetBSD: tty.c,v 1.67 2018/01/01 22:32:46 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: tty.c,v 1.66 2017/09/05 18:07:59 christos Exp $");
__RCSID("$NetBSD: tty.c,v 1.67 2018/01/01 22:32:46 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -586,7 +586,7 @@ tty_init(EditLine *el)
*/
libedit_private void
/*ARGSUSED*/
tty_end(EditLine *el)
tty_end(EditLine *el, int how)
{
if (el->el_flags & EDIT_DISABLED)
return;
@ -594,7 +594,8 @@ tty_end(EditLine *el)
if (!el->el_tty.t_initialized)
return;
if (tty_setty(el, TCSAFLUSH, &el->el_tty.t_or) == -1) {
if (tty_setty(el, how, &el->el_tty.t_or) == -1)
{
#ifdef DEBUG_TTY
(void) fprintf(el->el_errfile,
"%s: tty_setty: %s\n", __func__, strerror(errno));

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.h,v 1.21 2016/05/09 21:46:56 christos Exp $ */
/* $NetBSD: tty.h,v 1.22 2018/01/01 22:32:46 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -457,7 +457,7 @@ typedef struct {
typedef unsigned char ttychar_t[NN_IO][C_NCC];
libedit_private int tty_init(EditLine *);
libedit_private void tty_end(EditLine *);
libedit_private void tty_end(EditLine *, int);
libedit_private int tty_stty(EditLine *, int, const wchar_t **);
libedit_private int tty_rawmode(EditLine *);
libedit_private int tty_cookedmode(EditLine *);