aboutsummaryrefslogtreecommitdiff
path: root/readline/rltty.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-10-07 12:52:13 -0600
committerTom Tromey <tom@tromey.com>2019-08-12 10:57:56 -0600
commit775e241e9c5f2b2ff2b59972ab70e5f20763fae6 (patch)
tree597ab643dce69ee6e98e46ecac00ee85f447bb4b /readline/rltty.c
parent08132bdd876fa1825810f90ecc25390dd4ded457 (diff)
downloadgdb-775e241e9c5f2b2ff2b59972ab70e5f20763fae6.zip
gdb-775e241e9c5f2b2ff2b59972ab70e5f20763fae6.tar.gz
gdb-775e241e9c5f2b2ff2b59972ab70e5f20763fae6.tar.bz2
Import readline 7.0 (patch 5)
This imports readline 7.0 (up to patch 5) while preserving all gdb-local changes. This was done by checking out the readline git repository, making a branch based on the gdb baseline revision, applying the gdb changes to that branch, and then merging from readline 7. readline/ChangeLog.gdb 2019-08-12 Tom Tromey <tom@tromey.com> * Imported readline 7.0 patch 5.
Diffstat (limited to 'readline/rltty.c')
-rw-r--r--readline/rltty.c67
1 files changed, 51 insertions, 16 deletions
diff --git a/readline/rltty.c b/readline/rltty.c
index d237b1c..b1c7929 100644
--- a/readline/rltty.c
+++ b/readline/rltty.c
@@ -1,10 +1,10 @@
/* rltty.c -- functions to prepare and restore the terminal for readline's
use. */
-/* Copyright (C) 1992-2005 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2016 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
- for reading lines of text with interactive input and history editing.
+ for reading lines of text with interactive input and history editing.
Readline is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,11 +37,11 @@
#include "rldefs.h"
-#if defined (GWINSZ_IN_SYS_IOCTL)
-# include <sys/ioctl.h>
-#endif /* GWINSZ_IN_SYS_IOCTL */
-
#include "rltty.h"
+#if defined (HAVE_SYS_IOCTL_H)
+# include <sys/ioctl.h> /* include for declaration of ioctl */
+#endif
+
#include "readline.h"
#include "rlprivate.h"
@@ -60,7 +60,13 @@ static void set_winsize PARAMS((int));
/* */
/* **************************************************************** */
-/* Non-zero means that the terminal is in a prepped state. */
+/* Non-zero means that the terminal is in a prepped state. There are several
+ flags that are OR'd in to denote whether or not we have sent various
+ init strings to the terminal. */
+#define TPX_PREPPED 0x01
+#define TPX_BRACKPASTE 0x02
+#define TPX_METAKEY 0x04
+
static int terminal_prepped;
static _RL_TTY_CHARS _rl_tty_chars, _rl_last_tty_chars;
@@ -121,7 +127,7 @@ static int set_tty_settings PARAMS((int, TIOTYPE *));
static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
-static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t));
+static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t *));
static void
save_tty_chars (tiop)
@@ -341,7 +347,7 @@ static int set_tty_settings PARAMS((int, TIOTYPE *));
static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
-static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t));
+static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t *));
static void _rl_bind_tty_special_chars PARAMS((Keymap, TIOTYPE));
#if defined (FLUSHO)
@@ -528,10 +534,10 @@ prepare_terminal_settings (meta_flag, oldtio, tiop)
#if defined (USE_XON_XOFF)
#if defined (IXANY)
- tiop->c_iflag &= ~(IXON | IXOFF | IXANY);
+ tiop->c_iflag &= ~(IXON | IXANY);
#else
/* `strict' Posix systems do not define IXANY. */
- tiop->c_iflag &= ~(IXON | IXOFF);
+ tiop->c_iflag &= ~IXON;
#endif /* IXANY */
#endif /* USE_XON_XOFF */
@@ -595,7 +601,7 @@ void
rl_prep_terminal (meta_flag)
int meta_flag;
{
- int tty;
+ int tty, nprep;
TIOTYPE tio;
if (terminal_prepped)
@@ -642,7 +648,7 @@ rl_prep_terminal (meta_flag)
/* If editing in vi mode, make sure we set the bindings in the
insertion keymap no matter what keymap we ended up in. */
if (rl_editing_mode == vi_mode)
- _rl_bind_tty_special_chars (vi_insertion_keymap, tio);
+ _rl_bind_tty_special_chars (vi_insertion_keymap, tio);
else
#endif
_rl_bind_tty_special_chars (_rl_keymap, tio);
@@ -659,8 +665,16 @@ rl_prep_terminal (meta_flag)
if (_rl_enable_keypad)
_rl_control_keypad (1);
+ nprep = TPX_PREPPED;
+
+ if (_rl_enable_bracketed_paste)
+ {
+ fprintf (rl_outstream, BRACK_PASTE_INIT);
+ nprep |= TPX_BRACKPASTE;
+ }
+
fflush (rl_outstream);
- terminal_prepped = 1;
+ terminal_prepped = nprep;
RL_SETSTATE(RL_STATE_TERMPREPPED);
_rl_release_sigint ();
@@ -672,13 +686,16 @@ rl_deprep_terminal ()
{
int tty;
- if (!terminal_prepped)
+ if (terminal_prepped == 0)
return;
/* Try to keep this function from being interrupted. */
_rl_block_sigint ();
- tty = rl_instream ? fileno (rl_instream) : fileno (stdout);
+ tty = rl_instream ? fileno (rl_instream) : fileno (stdin);
+
+ if (terminal_prepped & TPX_BRACKPASTE)
+ fprintf (rl_outstream, BRACK_PASTE_FINI);
if (_rl_enable_keypad)
_rl_control_keypad (0);
@@ -697,6 +714,19 @@ rl_deprep_terminal ()
_rl_release_sigint ();
}
#endif /* !NO_TTY_DRIVER */
+
+/* Set readline's idea of whether or not it is echoing output to the terminal,
+ returning the old value. */
+int
+rl_tty_set_echoing (u)
+ int u;
+{
+ int o;
+
+ o = _rl_echoing_p;
+ _rl_echoing_p = u;
+ return o;
+}
/* **************************************************************** */
/* */
@@ -859,6 +889,11 @@ _rl_bind_tty_special_chars (kmap, ttybuff)
# endif /* VLNEXT && TERMIOS_TTY_DRIVER */
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
+# if defined (VI_MODE)
+ if (rl_editing_mode == vi_mode)
+ SET_SPECIAL (VWERASE, rl_vi_unix_word_rubout);
+ else
+# endif
SET_SPECIAL (VWERASE, rl_unix_word_rubout);
# endif /* VWERASE && TERMIOS_TTY_DRIVER */
}