Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit Only FLUSH if we are ending libedit; DRAIN if we...



details:   https://anonhg.NetBSD.org/src/rev/5f8c5057b0ac
branches:  trunk
changeset: 828795:5f8c5057b0ac
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 01 22:32:46 2018 +0000

description:
Only FLUSH if we are ending libedit; DRAIN if we suspend for readline.
This allows pasting multiline buffers (Gerry Swislow)

diffstat:

 lib/libedit/el.c       |  6 +++---
 lib/libedit/readline.c |  8 ++++----
 lib/libedit/tty.c      |  9 +++++----
 lib/libedit/tty.h      |  4 ++--
 4 files changed, 14 insertions(+), 13 deletions(-)

diffs (118 lines):

diff -r d526d91dc8a4 -r 5f8c5057b0ac lib/libedit/el.c
--- a/lib/libedit/el.c  Mon Jan 01 17:33:23 2018 +0000
+++ b/lib/libedit/el.c  Mon Jan 01 22:32:46 2018 +0000
@@ -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 @@
        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);
diff -r d526d91dc8a4 -r 5f8c5057b0ac lib/libedit/readline.c
--- a/lib/libedit/readline.c    Mon Jan 01 17:33:23 2018 +0000
+++ b/lib/libedit/readline.c    Mon Jan 01 22:32:46 2018 +0000
@@ -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 @@
        _resize_fun(e, &rl_line_buffer);
        _rl_update_pos();
 
-       tty_end(e);
+       tty_end(e, TCSADRAIN);
 
        return 0;
 }
@@ -460,7 +460,7 @@
        history_length = ev.num;
 
 out:
-       tty_end(e);
+       tty_end(e, TCSADRAIN);
        return buf;
 }
 
diff -r d526d91dc8a4 -r 5f8c5057b0ac lib/libedit/tty.c
--- a/lib/libedit/tty.c Mon Jan 01 17:33:23 2018 +0000
+++ b/lib/libedit/tty.c Mon Jan 01 22:32:46 2018 +0000
@@ -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 @@
  */
 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 @@
        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));
diff -r d526d91dc8a4 -r 5f8c5057b0ac lib/libedit/tty.h
--- a/lib/libedit/tty.h Mon Jan 01 17:33:23 2018 +0000
+++ b/lib/libedit/tty.h Mon Jan 01 22:32:46 2018 +0000
@@ -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 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 *);



Home | Main Index | Thread Index | Old Index