#! /bin/sh
-# From configure.ac for Readline 8.0, version 2.86.
+# From configure.ac for Readline 8.0, version 2.87.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for readline 8.0.
#
-# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
-test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
+# If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
+test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
if test $ac_cv_c_compiler_gnu = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
nsigint++;
}
+int
main()
{
nsigint = 0;
#include <setjmp.h>
#include <stdlib.h>
+int
main()
{
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
#if defined (HAVE_LOCALE_H)
#include <locale.h>
#endif
+#include <string.h>
+#include <stdlib.h>
+int
main(c, v)
int c;
char *v[];
#endif
#include <stdio.h>
#include <ctype.h>
+#include <stdlib.h>
+int
main(c, v)
int c;
char *v[];
#include <locale.h>
#include <wchar.h>
+int
main(c, v)
int c;
char **v;
dnl
dnl Process this file with autoconf to produce a configure script.
-# Copyright (C) 1987-2019 Free Software Foundation, Inc.
+# Copyright (C) 1987-2020 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_REVISION([for Readline 8.0, version 2.86])
+AC_REVISION([for Readline 8.0, version 2.87])
AC_INIT(readline, 8.0, bug-readline@gnu.org)
dnl AC_AIX
AC_MINIX
-# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
-test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
+# If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
+test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2"
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
static int forced_display;
/* Default and initial buffer size. Can grow. */
-static int line_size = DEFAULT_LINE_BUFFER_SIZE;
+static int line_size = DEFAULT_LINE_BUFFER_SIZE;
/* Set to a non-zero value if horizontal scrolling has been enabled
automatically because the terminal was resized to height 1. */
_rl_last_v_pos++;
/* 5a. If the number of screen positions doesn't match, punt
- and do a dumb update. */
- if (newwidth != oldwidth)
+ and do a dumb update.
+ 5b. If the number of bytes is greater in the new line than
+ the old, do a dumb update, because there is no guarantee we
+ can extend the old line enough to fit the new bytes. */
+ if (newwidth != oldwidth || newbytes > oldbytes)
{
oe = old + omax;
ne = new + nmax;
consume the first character of old. Fix up `old' so it
reflects the new screen contents. We use +1 in the
memmove call to copy the trailing NUL. */
- memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1);
+ /* (strlen(old+oldbytes) == (omax - oldbytes - 1)) */
+
+ /* Don't bother trying to fit the bytes if the number of bytes
+ doesn't change. */
+ if (oldbytes != newbytes)
+ memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1);
memcpy (old, new, newbytes);
j = newbytes - oldbytes;
-
omax += j;
/* Fix up indices if we copy data from one line to another */
- for (i = current_line+1; i <= inv_botlin+1; i++)
+ for (i = current_line+1; j != 0 && i <= inv_botlin+1 && i <=_rl_vis_botlin+1; i++)
vis_lbreaks[i] += j;
}
}
_rl_copy_to_kill_ring (text, rl_point < rl_mark);
}
+ _rl_fix_point (1);
_rl_last_command_was_kill++;
return 0;
}
npoint = (rl_point < rl_mark) ? rl_point : rl_mark;
r = region_kill_internal (1);
- _rl_fix_point (1);
rl_point = npoint;
+ _rl_fix_point (1);
return r;
}
/* text.c */
extern void _rl_fix_point PARAMS((int));
+extern void _rl_fix_mark PARAMS((void));
extern int _rl_replace_text PARAMS((const char *, int, int));
extern int _rl_forward_char_internal PARAMS((int));
extern int _rl_backward_char_internal PARAMS((int));
rl_end -= diff;
rl_line_buffer[rl_end] = '\0';
+ _rl_fix_mark ();
return (diff);
}
if (fix_mark_too)
_RL_FIX_POINT (rl_mark);
}
+
+void
+_rl_fix_mark (void)
+{
+ _RL_FIX_POINT (rl_mark);
+}
#undef _RL_FIX_POINT
/* Replace the contents of the line buffer between START and END with
while (count)
{
+ if (rl_point > rl_end)
+ rl_point = rl_end;
if (rl_point == rl_end)
return 0;
}
}
+ if (rl_point > rl_end)
+ rl_point = rl_end;
if (rl_point == rl_end)
return 0;
}
else if (m < mlen)
{
- rl_extend_line_buffer (mlen - m + 1);
+ rl_extend_line_buffer (rl_end + mlen + (e - s) - m + 2);
+ s = rl_line_buffer + start; /* have to redo this */
+ e = rl_line_buffer + rl_end;
memmove (s + mlen, s + m, (e - s) - m);
memcpy (s, mb, mlen);
next += mlen - m; /* next char changes */
/* vi_mode.c -- A vi emulation mode for Bash.
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
-/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
start = end - vi_replace_count + 1;
len = vi_replace_count + 1;
+ if (start < 0)
+ {
+ len = end + 1;
+ start = 0;
+ }
+
vi_save_insert_buffer (start, len);
}
/* Append a blank character temporarily so that the motion routines
work right at the end of the line. Original value of rl_end is saved
as m->end. */
+ rl_extend_line_buffer (rl_end + 1);
rl_line_buffer[rl_end++] = ' ';
rl_line_buffer[rl_end] = '\0';
/* Remove the blank that we added in rl_domove_motion_callback. */
rl_end = m->end;
rl_line_buffer[rl_end] = '\0';
- if (rl_point > rl_end)
- rl_point = rl_end;
+ _rl_fix_point (0);
/* No change in position means the command failed. */
if (rl_mark == rl_point)
rl_do_undo ();
rl_point = m->start;
+ _rl_fix_point (1);
+
return (0);
}
s = rl_point;
if (rl_do_undo ())
- vi_replace_count--;
+ vi_replace_count--; /* XXX */
if (rl_point == s)
rl_backward_char (1, key);
return (0);
}
+static int
+rl_vi_overstrike_kill_line (int count, int key)
+{
+ int r, end;
+
+ end = rl_end;
+ r = rl_unix_line_discard (count, key);
+ vi_replace_count -= end - rl_end;
+ return r;
+}
+
+static int
+rl_vi_overstrike_kill_word (int count, int key)
+{
+ int r, end;
+
+ end = rl_end;
+ r = rl_vi_unix_word_rubout (count, key);
+ vi_replace_count -= end - rl_end;
+ return r;
+}
+
+static int
+rl_vi_overstrike_yank (int count, int key)
+{
+ int r, end;
+
+ end = rl_end;
+ r = rl_yank (count, key);
+ vi_replace_count += rl_end - end;
+ return r;
+}
+
/* Read bracketed paste mode pasted text and insert it in overwrite mode */
static int
rl_vi_overstrike_bracketed_paste (int count, int key)
vi_insertion_keymap[CTRL ('H')].function == rl_rubout)
vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete;
+ /* Same for ^U and unix-line-discard. */
+ if (vi_insertion_keymap[CTRL ('U')].type == ISFUNC &&
+ vi_insertion_keymap[CTRL ('U')].function == rl_unix_line_discard)
+ vi_replace_map[CTRL ('U')].function = rl_vi_overstrike_kill_line;
+
+ /* And for ^W and unix-word-rubout. */
+ if (vi_insertion_keymap[CTRL ('W')].type == ISFUNC &&
+ vi_insertion_keymap[CTRL ('W')].function == rl_vi_unix_word_rubout)
+ vi_replace_map[CTRL ('W')].function = rl_vi_overstrike_kill_word;
+
+ /* And finally for ^Y and yank. */
+ if (vi_insertion_keymap[CTRL ('Y')].type == ISFUNC &&
+ vi_insertion_keymap[CTRL ('Y')].function == rl_yank)
+ vi_replace_map[CTRL ('Y')].function = rl_vi_overstrike_yank;
+
/* Make sure this is the value we need. */
vi_replace_map[ANYOTHERKEY].type = ISFUNC;
vi_replace_map[ANYOTHERKEY].function = (rl_command_func_t *)NULL;
if (ch == '`')
{
rl_point = rl_mark;
+ _rl_fix_point (1);
return 0;
}
else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
return 1;
}
rl_point = vi_mark_chars[ch];
+ _rl_fix_point (1);
return 0;
}