From cc88a640ca1d0356c5feb40bb48869bab5a2bdce Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 11 May 2011 23:38:44 +0000 Subject: Imported readline 6.2, and upstream patch 001. [patch 0/3] readline-6.2 rebase http://sourceware.org/ml/gdb-patches/2011-05/msg00003.html [patch 1/3] readline-6.2: Merge of already posted patches http://sourceware.org/ml/gdb-patches/2011-05/msg00004.html = [Bug-readline] [RFC/readline] bind.c, rl_function_dumper, Free allocated http://lists.gnu.org/archive/html/bug-readline/2011-03/msg00000.html [Bug-readline] [patch] Fix underquotation in readline/examples/rlfe/conf http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00001.html [Bug-readline] [patch] Makefile.in htm<->html http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00002.html Re: [Bug-readline] [patch] Makefile.in dependency: callback.o: xmalloc.h http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00004.html [Bug-readline] [patch] Remove . from the VPATH directive http://lists.gnu.org/archive/html/bug-readline/2011-04/msg00005.html Eli Zaretskii's __MSDOS__ / __GO32__ / __MINGW32__ / __DJGPP__ stuff: http://sourceware.org/ml/gdb/2011-04/msg00002.html Jan Kratochvil's patch for FSF GDB tree local-specific changes: http://sourceware.org/ml/gdb/2011-04/msg00006.html Preservation of existing ChangeLog.gdb files, their updates. [patch 2/3] readline-6.2: Workaround "ask" regression http://sourceware.org/ml/gdb-patches/2011-05/msg00005.html [patch 3/3] readline-6.2: Revert 5.x compat., apply 6.x compat. http://sourceware.org/ml/gdb-patches/2011-05/msg00006.html [patch 4/3] readline-6.2: Substitute inc-hist.texinfo http://sourceware.org/ml/gdb-patches/2011-05/msg00010.html readline/ Workaround gdb.base/completion.exp regression on readline-6.2. * complete.c (get_y_or_n): Disable the return on RL_STATE_CALLBACK. Imported readline 6.2, and upstream patch 001. * configure: Regenerate. readline/doc/ * hsuser.texi (Using History Interactively): Disable !BashFeatures @defcodeindex. Make the `Programming with GNU History' reference external. * inc-hist.texinfo: Remove. Imported readline 6.2, and upstream patch 001. readline/examples/ Imported readline 6.2, and upstream patch 001. readline/examples/rlfe/ Imported readline 6.2, and upstream patch 001. gdb/ * config.in: Regenerate. * configure: Regenerate. * configure.ac <--with-system-readline> (for readline_echoing_p): Remove the test. * tui/tui-io.c (tui_old_readline_echoing_p): Rename to ... (tui_old_rl_echoing_p): ... here. (tui_setup_io): Rename extern declaration readline_echoing_p to _rl_echoing_p. Adjust assignments for the both renames. gdb/doc/ * Makefile.in (GDB_DOC_SOURCE_INCLUDES): Rename inc-hist.texinfo to hsuser.texi. * gdb.texinfo : Rename inc-hist.texinfo inclusion and comment to hsuser.texi. Change rluser.texi name in the comment. --- readline/terminal.c | 98 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 34 deletions(-) (limited to 'readline/terminal.c') diff --git a/readline/terminal.c b/readline/terminal.c index 46b50e7..255b5e6 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -1,24 +1,24 @@ /* terminal.c -- controlling the terminal with termcap. */ -/* Copyright (C) 1996-2005 Free Software Foundation, Inc. +/* Copyright (C) 1996-2009 Free Software Foundation, Inc. - This file is part of the GNU Readline Library, a library for - reading lines of text with interactive input and history editing. + This file is part of the GNU Readline Library (Readline), a library + for reading lines of text with interactive input and history editing. - The GNU Readline Library is free software; you can redistribute it - and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2, or + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - The GNU Readline Library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + Readline is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - The GNU General Public License is often shipped with GNU software, and - is generally kept in a file called COPYING or LICENSE. If you do not - have a copy of the license, write to the Free Software Foundation, - 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ + You should have received a copy of the GNU General Public License + along with Readline. If not, see . +*/ + #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) @@ -71,6 +71,17 @@ #include "xmalloc.h" #if defined (__MINGW32__) +# include +# include + +static void _win_get_screensize PARAMS((int *, int *)); +#endif + +#if defined (__EMX__) +static void _emx_get_screensize PARAMS((int *, int *)); +#endif + +#if defined (__MINGW32__) # include # include #endif @@ -78,7 +89,10 @@ #define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay) #define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc) -int rl_prefer_env_winsize; +/* If the calling application sets this to a non-zero value, readline will + use the $LINES and $COLUMNS environment variables to set its idea of the + window size before interrogating the kernel. */ +int rl_prefer_env_winsize = 0; /* **************************************************************** */ /* */ @@ -93,12 +107,12 @@ static char *term_string_buffer = (char *)NULL; static int tcap_initialized; -#if !defined (__linux__) +#if !defined (__linux__) && !defined (NCURSES_VERSION) # if defined (__EMX__) || defined (NEED_EXTERN_PC) extern # endif /* __EMX__ || NEED_EXTERN_PC */ char PC, *BC, *UP; -#endif /* __linux__ */ +#endif /* !__linux__ && !NCURSES_VERSION */ /* Some strings to control terminal actions. These are output by tputs (). */ char *_rl_term_clreol; @@ -122,9 +136,7 @@ char *_rl_term_IC; char *_rl_term_dc; char *_rl_term_DC; -#if defined (HACK_TERMCAP_MOTION) char *_rl_term_forward_char; -#endif /* HACK_TERMCAP_MOTION */ /* How to go up a line. */ char *_rl_term_up; @@ -195,6 +207,26 @@ _emx_get_screensize (swp, shp) } #endif +#if defined (__MINGW32__) +static void +_win_get_screensize (swp, shp) + int *swp, *shp; +{ + HANDLE hConOut; + CONSOLE_SCREEN_BUFFER_INFO scr; + + hConOut = GetStdHandle (STD_OUTPUT_HANDLE); + if (hConOut != INVALID_HANDLE_VALUE) + { + if (GetConsoleScreenBufferInfo (hConOut, &scr)) + { + *swp = scr.dwSize.X; + *shp = scr.srWindow.Bottom - scr.srWindow.Top + 1; + } + } +} +#endif + /* Get readline's idea of the screen size. TTY is a file descriptor open to the terminal. If IGNORE_ENV is true, we do not pay attention to the values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being @@ -233,7 +265,9 @@ _rl_get_screen_size (tty, ignore_env) #endif #if defined (__EMX__) - _emx_get_screensize (&_rl_screenwidth, &_rl_screenheight); + _emx_get_screensize (&wc, &wr); +#elif defined (__MINGW32__) + _win_get_screensize (&wc, &wr); #endif if (ignore_env || rl_prefer_env_winsize == 0) @@ -347,24 +381,24 @@ rl_reset_screen_size () void rl_resize_terminal () { - if (readline_echoing_p) + _rl_get_screen_size (fileno (rl_instream), 1); + if (_rl_echoing_p) { - _rl_get_screen_size (fileno (rl_instream), 1); if (CUSTOM_REDISPLAY_FUNC ()) rl_forced_update_display (); - else + else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0) _rl_redisplay_after_sigwinch (); } } struct _tc_string { - const char *tc_var; + const char * const tc_var; char **tc_value; }; /* This should be kept sorted, just in case we decide to change the search algorithm to something smarter. */ -static struct _tc_string tc_strings[] = +static const struct _tc_string tc_strings[] = { { "@7", &_rl_term_at7 }, { "DC", &_rl_term_DC }, @@ -389,9 +423,7 @@ static struct _tc_string tc_strings[] = { "le", &_rl_term_backspace }, { "mm", &_rl_term_mm }, { "mo", &_rl_term_mo }, -#if defined (HACK_TERMCAP_MOTION) { "nd", &_rl_term_forward_char }, -#endif { "pc", &_rl_term_pc }, { "up", &_rl_term_up }, { "vb", &_rl_visible_bell }, @@ -505,9 +537,7 @@ _rl_init_terminal_io (terminal_name) _rl_term_ks = _rl_term_ke = _rl_term_at7 = (char *)NULL; _rl_term_mm = _rl_term_mo = (char *)NULL; _rl_term_ve = _rl_term_vs = (char *)NULL; -#if defined (HACK_TERMCAP_MOTION) - term_forward_char = (char *)NULL; -#endif + _rl_term_forward_char = (char *)NULL; _rl_terminal_can_insert = term_has_meta = 0; /* Reasonable defaults for tgoto(). Readline currently only uses @@ -546,8 +576,8 @@ _rl_init_terminal_io (terminal_name) /* Check to see if this terminal has a meta key and clear the capability variables if there is none. */ - term_has_meta = (tgetflag ("km") || tgetflag ("MT")); - if (!term_has_meta) + term_has_meta = tgetflag ("km") != 0; + if (term_has_meta == 0) _rl_term_mm = _rl_term_mo = (char *)NULL; #endif /* !__MSDOS__ */ @@ -663,10 +693,10 @@ _rl_backspace (count) int rl_crlf () { -#if defined (NEW_TTY_DRIVER) +#if defined (NEW_TTY_DRIVER) || defined (__MINT__) if (_rl_term_cr) tputs (_rl_term_cr, 1, _rl_output_character_function); -#endif /* NEW_TTY_DRIVER */ +#endif /* NEW_TTY_DRIVER || __MINT__ */ putc ('\n', _rl_out_stream); return 0; } @@ -675,7 +705,7 @@ rl_crlf () int rl_ding () { - if (readline_echoing_p) + if (_rl_echoing_p) { switch (_rl_bell_preference) { -- cgit v1.1