readline rebase 5.1->6.2?

Eli Zaretskii eliz@gnu.org
Fri Apr 1 09:30:00 GMT 2011


> Date: Tue, 22 Mar 2011 21:58:15 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: gdb@sourceware.org, ktietz@redhat.com, cgf-use-the-mailinglist-please@gnu.org
> 
> > Date: Tue, 22 Mar 2011 20:48:36 +0100
> > From: Jan Kratochvil <jan.kratochvil@redhat.com>
> > Cc: gdb@sourceware.org, ktietz@redhat.com,
> >         cgf-use-the-mailinglist-please@gnu.org
> > 
> > I do not have anything else than you have.  I just used diff on
> > 	ftp://ftp.cwru.edu/pub/bash/readline-5.1.tar.gz
> > vs. src/readline.  But one should rather check individual patches
> > with git annotate / git show etc. and compare them against readline-6.2.
> 
> OK, I will have a look.

I compared readline-6.2 with our local changes since 5.1, and I see
that the changes below are not in 6.2.  I only paid attention to
DJGPP/MSDOS-specific patches and to MinGW-specific patches, because
Jan seemed to have covered the rest.  (One of the MinGW-specific
patches has a comment saying the underlying problem should be fixed in
readline 5.2, but I don't know what is the problem, so I couldn't
check whether it is indeed fixed.)

The question is, what should we do about these patches?  Submitting
them to upstream readline would be the best course (assuming the
readline maintainer is willing to include them), but that means we
will have to either wait for the next readline release or keep our
local patches for the time being.

--- display.c	20 Apr 2006 20:05:36 -0000	1.1.1.7
+++ display.c	24 Mar 2008 12:59:51 -0000	1.12
@@ -41,6 +41,10 @@
 
 #include <stdio.h>
 
+#ifdef __MSDOS__
+# include <pc.h>
+#endif
+
 /* System-specific feature definitions and include files. */
 #include "rldefs.h"
 #include "rlmbutil.h"
@@ -1782,9 +1792,18 @@ _rl_move_vert (to)
     }
   else
     {			/* delta < 0 */
+#ifdef __MSDOS__
+      int row, col;
+
+      fflush (rl_outstream); /* make sure the cursor pos is current! */
+      ScreenGetCursor (&row, &col);
+      ScreenSetCursor (row + delta, col);
+      i = -delta;    /* in case someone wants to use it after the loop */
+#else /* !__MSDOS__ */
       if (_rl_term_up && *_rl_term_up)
 	for (i = 0; i < -delta; i++)
 	  tputs (_rl_term_up, 1, _rl_output_character_function);
+#endif /* !__MSDOS__ */
     }
 
   _rl_last_v_pos = to;		/* Now TO is here */
@@ -2036,9 +2057,12 @@ void
 _rl_clear_to_eol (count)
      int count;
 {
+#ifndef __MSDOS__
   if (_rl_term_clreol)
     tputs (_rl_term_clreol, 1, _rl_output_character_function);
-  else if (count)
+  else
+#endif
+  if (count)
     space_to_eol (count);
 }
 
@@ -2059,10 +2083,15 @@ space_to_eol (count)
 void
 _rl_clear_screen ()
 {
+#if defined (__GO32__)
+  ScreenClear ();	/* FIXME: only works in text modes */
+  ScreenSetCursor (0, 0);  /* term_clrpag is "cl" which homes the cursor */
+#else
   if (_rl_term_clrpag)
     tputs (_rl_term_clrpag, 1, _rl_output_character_function);
   else
     rl_crlf ();
+#endif
 }
 
 /* Insert COUNT characters from STRING to the output stream at column COL. */


--- emacs_keymap.c	23 Aug 2002 22:02:28 -0000	1.1.1.3
+++ emacs_keymap.c	5 May 2006 18:26:12 -0000	1.6
@@ -278,7 +278,13 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap
   { ISFUNC, rl_insert },	/* Latin capital letter Y with acute */
   { ISFUNC, rl_insert },	/* Latin capital letter thorn (Icelandic) */
   { ISFUNC, rl_insert },	/* Latin small letter sharp s (German) */
+#ifndef __MINGW32__
   { ISFUNC, rl_insert },	/* Latin small letter a with grave */
+#else
+  /* Temporary - this is a bug in readline 5.1 that should be fixed in
+     readline 5.2.  */
+  { ISFUNC, 0 },		/* Must leave this unbound for the arrow keys to work.  */
+#endif
   { ISFUNC, rl_insert },	/* Latin small letter a with acute */
   { ISFUNC, rl_insert },	/* Latin small letter a with circumflex */
   { ISFUNC, rl_insert },	/* Latin small letter a with tilde */


--- terminal.c	20 Apr 2006 20:05:37 -0000	1.1.1.7
+++ terminal.c	13 Nov 2006 09:33:30 -0000	1.11
@@ -55,6 +55,10 @@
 #  include <sys/ioctl.h>
 #endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
 
+#ifdef __MSDOS__
+# include <pc.h>
+#endif
+
 #include "rltty.h"
 #include "tcap.h"
 
@@ -66,6 +70,11 @@
 #include "rlshell.h"
 #include "xmalloc.h"
 
+#if defined (__MINGW32__)
+# include <windows.h>
+# include <wincon.h>
+#endif
+
 #define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
 #define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
 
@@ -77,8 +86,10 @@ int rl_prefer_env_winsize;
 /*								    */
 /* **************************************************************** */
 
+#ifndef __MSDOS__
 static char *term_buffer = (char *)NULL;
 static char *term_string_buffer = (char *)NULL;
+#endif /* !__MSDOS__ */
 
 static int tcap_initialized;
 
@@ -207,6 +218,20 @@ _rl_get_screen_size (tty, ignore_env)
     }
 #endif /* TIOCGWINSZ */
 
+  /* For MinGW, we get the console size from the Windows API.  */
+#if defined (__MINGW32__)
+  HANDLE hConOut = GetStdHandle (STD_OUTPUT_HANDLE);
+  if (hConOut != INVALID_HANDLE_VALUE)
+    {
+      CONSOLE_SCREEN_BUFFER_INFO scr;
+      if (GetConsoleScreenBufferInfo (hConOut, &scr))
+	{
+	  wc = scr.dwSize.X;
+	  wr = scr.srWindow.Bottom - scr.srWindow.Top + 1;
+	}
+    }
+#endif
+
 #if defined (__EMX__)
   _emx_get_screensize (&_rl_screenwidth, &_rl_screenheight);
 #endif
@@ -230,7 +255,10 @@ _rl_get_screen_size (tty, ignore_env)
       if (_rl_screenwidth <= 0)
         _rl_screenwidth = wc;
 
-#if !defined (__DJGPP__)
+#if defined (__DJGPP__)
+      if (_rl_screenwidth <= 0)
+	_rl_screenwidth = ScreenCols ();
+#else
       if (_rl_screenwidth <= 0 && term_string_buffer)
 	_rl_screenwidth = tgetnum ("co");
 #endif
@@ -246,7 +274,10 @@ _rl_get_screen_size (tty, ignore_env)
       if (_rl_screenheight <= 0)
         _rl_screenheight = wr;
 
-#if !defined (__DJGPP__)
+#if defined (__DJGPP__)
+      if (_rl_screenheight <= 0)
+	_rl_screenheight = ScreenRows ();
+#else
       if (_rl_screenheight <= 0 && term_string_buffer)
 	_rl_screenheight = tgetnum ("li");
 #endif
@@ -397,6 +431,23 @@ _rl_init_terminal_io (terminal_name)
   if (term == 0)
     term = "dumb";
 
+#ifdef __MSDOS__
+  _rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
+  _rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
+  _rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
+  _rl_term_mm = _rl_term_mo = (char *)NULL;
+  _rl_terminal_can_insert = term_has_meta = _rl_term_autowrap = 0;
+  _rl_term_cr = "\r";
+  _rl_term_clreol = _rl_term_clrpag = _rl_term_backspace = (char *)NULL;
+  _rl_term_goto = _rl_term_pc = _rl_term_ip = (char *)NULL;
+  _rl_term_ks = _rl_term_ke =_rl_term_vs = _rl_term_ve = (char *)NULL;
+  _rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;
+#if defined(HACK_TERMCAP_MOTION)
+  _rl_term_forward_char = (char *)NULL;
+#endif
+
+  _rl_get_screen_size (tty, 0);
+#else  /* !__MSDOS__ */
   /* I've separated this out for later work on not calling tgetent at all
      if the calling application has supplied a custom redisplay function,
      (and possibly if the application has supplied a custom input function). */
@@ -499,6 +550,8 @@ _rl_init_terminal_io (terminal_name)
   if (!term_has_meta)
     _rl_term_mm = _rl_term_mo = (char *)NULL;
 
+#endif /* !__MSDOS__ */
+
   /* Attempt to find and bind the arrow keys.  Do not override already
      bound keys in an overzealous attempt, however. */
 
@@ -595,10 +648,12 @@ _rl_backspace (count)
 {
   register int i;
 
+#ifndef __MSDOS__
   if (_rl_term_backspace)
     for (i = 0; i < count; i++)
       tputs (_rl_term_backspace, 1, _rl_output_character_function);
   else
+#endif
     for (i = 0; i < count; i++)
       putc ('\b', _rl_out_stream);
   return 0;
@@ -628,12 +683,17 @@ rl_ding ()
 	default:
 	  break;
 	case VISIBLE_BELL:
+#ifdef __MSDOS__
+	  ScreenVisualBell ();
+	  break;
+#else
 	  if (_rl_visible_bell)
 	    {
 	      tputs (_rl_visible_bell, 1, _rl_output_character_function);
 	      break;
 	    }
 	  /* FALLTHROUGH */
+#endif
 	case AUDIBLE_BELL:
 	  fprintf (stderr, "\007");
 	  fflush (stderr);
@@ -685,6 +745,7 @@ void
 _rl_set_cursor (im, force)
      int im, force;
 {
+#ifndef __MSDOS__
   if (_rl_term_ve && _rl_term_vs)
     {
       if (force || im != rl_insert_mode)
@@ -695,4 +756,5 @@ _rl_set_cursor (im, force)
 	    tputs (_rl_term_ve, 1, _rl_output_character_function);
 	}
     }
+#endif
 }




More information about the Gdb mailing list