Module Name: src Committed By: christos Date: Mon Jan 1 22:32:47 UTC 2018
Modified Files: src/lib/libedit: el.c readline.c tty.c tty.h Log Message: Only FLUSH if we are ending libedit; DRAIN if we suspend for readline. This allows pasting multiline buffers (Gerry Swislow) To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/lib/libedit/el.c cvs rdiff -u -r1.145 -r1.146 src/lib/libedit/readline.c cvs rdiff -u -r1.66 -r1.67 src/lib/libedit/tty.c cvs rdiff -u -r1.21 -r1.22 src/lib/libedit/tty.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libedit/el.c diff -u src/lib/libedit/el.c:1.95 src/lib/libedit/el.c:1.96 --- src/lib/libedit/el.c:1.95 Tue Sep 5 14:07:59 2017 +++ src/lib/libedit/el.c Mon Jan 1 17:32:46 2018 @@ -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); Index: src/lib/libedit/readline.c diff -u src/lib/libedit/readline.c:1.145 src/lib/libedit/readline.c:1.146 --- src/lib/libedit/readline.c:1.145 Fri Dec 8 11:56:23 2017 +++ src/lib/libedit/readline.c Mon Jan 1 17:32:46 2018 @@ -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; } Index: src/lib/libedit/tty.c diff -u src/lib/libedit/tty.c:1.66 src/lib/libedit/tty.c:1.67 --- src/lib/libedit/tty.c:1.66 Tue Sep 5 14:07:59 2017 +++ src/lib/libedit/tty.c Mon Jan 1 17:32:46 2018 @@ -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)); Index: src/lib/libedit/tty.h diff -u src/lib/libedit/tty.h:1.21 src/lib/libedit/tty.h:1.22 --- src/lib/libedit/tty.h:1.21 Mon May 9 17:46:56 2016 +++ src/lib/libedit/tty.h Mon Jan 1 17:32:46 2018 @@ -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 *);