diff options
| author | Chet Ramey <chet.ramey@case.edu> | 2014-11-03 14:32:12 -0500 |
|---|---|---|
| committer | Chet Ramey <chet.ramey@case.edu> | 2014-11-03 14:32:12 -0500 |
| commit | f3aad56dceb53b14c8bb3e73d085ee45e39486d7 (patch) | |
| tree | 1200850107f098abf435e86a1e4870677f6a52ea /lib/readline/rltty.c | |
| parent | e0722a04ecfd67657486678e4481d7d089dfbcec (diff) | |
| download | bash-f3aad56dceb53b14c8bb3e73d085ee45e39486d7.tar.gz | |
commit bash-20141031 snapshot
Diffstat (limited to 'lib/readline/rltty.c')
| -rw-r--r-- | lib/readline/rltty.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/readline/rltty.c b/lib/readline/rltty.c index 908bae18..14fc7888 100644 --- a/lib/readline/rltty.c +++ b/lib/readline/rltty.c @@ -4,7 +4,7 @@ /* Copyright (C) 1992-2005 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 @@ -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; @@ -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,7 +686,7 @@ rl_deprep_terminal () { int tty; - if (!terminal_prepped) + if (terminal_prepped == 0) return; /* Try to keep this function from being interrupted. */ @@ -680,6 +694,9 @@ rl_deprep_terminal () 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); |
