-[Readline-specific changelog. Descriptions of changes to the source are
+\[Readline-specific changelog. Descriptions of changes to the source are
found in the bash changelog.]
6/9
to support the recommended `#include <readline/readline.h>'. Report
and fix from Andrea Bolognani <abologna@redhat.com>
+ 5/13
+ ----
+configure.ac
+ - hpux: add -DTGETENT_BROKEN to LOCAL_CFLAGS
ac_cv_c_long_long=yes
else
AC_TRY_RUN([
+#include <stdlib.h>
int
main()
{
ac_cv_c_long_double=yes
else
AC_TRY_RUN([
+#include <stdlib.h>
int
main()
{
#else
typedef int (*_bashfunc)();
#endif
+#include <stdlib.h>
main()
{
_bashfunc pf;
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
#ifndef UNDER_SYS_SIGLIST_DECLARED
extern char *_sys_siglist[];
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
#if !HAVE_DECL_SYS_SIGLIST
extern char *sys_siglist[];
#endif
[AC_TRY_RUN([
#include <sys/types.h>
#include <fcntl.h>
+#include <stdlib.h>
main()
{
int fd1, fd2, fl;
# include <ndir.h>
# endif
#endif /* HAVE_DIRENT_H */
+#include <stdlib.h>
main()
{
DIR *dir;
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <stdlib.h>
main()
{
#ifdef HAVE_QUAD_T
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#include <stdlib.h>
#ifndef __STDC__
# ifndef const
# define const
#include <sys/types.h>
#include <signal.h>
#include <setjmp.h>
+#include <stdlib.h>
main()
{
[AC_TRY_RUN([
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
int
main()
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#include <stdlib.h>
main()
{
# ifdef GETPGRP_VOID
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
typedef RETSIGTYPE sigfunc();
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
/* Add more tests in here as appropriate. */
main()
[AC_TRY_RUN([
#include <sys/types.h>
#include <signal.h>
+#include <stdlib.h>
#ifndef NSIG
# define NSIG 64
[AC_TRY_RUN([
#include <stdio.h>
#include <readline/readline.h>
+#include <stdlib.h>
extern int rl_gnu_readline_p;
AC_CACHE_CHECK([for standard-conformant snprintf], [bash_cv_func_snprintf],
[AC_TRY_RUN([
#include <stdio.h>
+#include <stdlib.h>
main()
{
rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
{
char *keys;
- int keys_len, prevkey;
+ int keys_len, prevkey, ic;
register int i;
KEYMAP_ENTRY k;
Keymap prevmap;
for (i = 0; i < keys_len; i++)
{
unsigned char uc = keys[i];
- int ic;
if (i > 0)
prevkey = ic;
{
i++; /* seq[i] == '-' */
/* XXX - obey convert-meta setting, convert to key seq */
+ /* XXX - doesn't yet handle \M-\C-n if convert-meta is on */
if (_rl_convert_meta_chars_to_ascii)
{
array[l++] = ESC; /* ESC is meta-prefix */
#! /bin/sh
-# From configure.ac for Readline 8.0, version 2.85.
+# From configure.ac for Readline 8.0, version 2.86.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for readline 8.0.
#
case "$host_os" in
isc*) LOCAL_CFLAGS=-Disc386 ;;
+hpux*) LOCAL_CFLAGS=-DTGETENT_BROKEN ;;
esac
# shared library configuration section
dnl
dnl Process this file with autoconf to produce a configure script.
-# Copyright (C) 1987-2018 Free Software Foundation, Inc.
+# Copyright (C) 1987-2019 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.85])
+AC_REVISION([for Readline 8.0, version 2.86])
AC_INIT(readline, 8.0, bug-readline@gnu.org)
case "$host_os" in
isc*) LOCAL_CFLAGS=-Disc386 ;;
+hpux*) LOCAL_CFLAGS=-DTGETENT_BROKEN ;;
esac
# shared library configuration section
static char *expand_prompt PARAMS((char *, int, int *, int *, int *, int *));
+#define DEFAULT_LINE_BUFFER_SIZE 1024
+
/* State of visible and invisible lines. */
struct line_state
{
static int forced_display;
/* Default and initial buffer size. Can grow. */
-static int line_size = 1024;
+static int line_size = DEFAULT_LINE_BUFFER_SIZE;
/* Variables to keep track of the expanded prompt string, which may
include invisible characters. */
{
/* The prompt spans multiple lines. */
t = ++p;
- local_prompt = expand_prompt (p, PMT_MULTILINE,
- &prompt_visible_length,
- &prompt_last_invisible,
- &prompt_invis_chars_first_line,
- &prompt_physical_chars);
c = *t; *t = '\0';
/* The portion of the prompt string up to and including the
final newline is now null-terminated. */
(int *)NULL,
(int *)NULL);
*t = c;
+
+ local_prompt = expand_prompt (p, PMT_MULTILINE,
+ &prompt_visible_length,
+ &prompt_last_invisible,
+ &prompt_invis_chars_first_line,
+ &prompt_physical_chars);
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
return (prompt_prefix_length);
}
{
register int n;
+ if (minsize <= _rl_screenwidth) /* XXX - for gdb */
+ minsize = _rl_screenwidth + 1;
+
if (invisible_line == 0) /* initialize it */
{
if (line_size < minsize)
init_line_structures (0);
rl_on_new_line ();
}
+ else if (line_size <= _rl_screenwidth)
+ init_line_structures (_rl_screenwidth + 1);
+
/* Draw the line into the buffer. */
cpos_buffer_position = -1;
or equal to 0, Readline's idea of that terminal dimension is unchanged.
This is intended to tell Readline the physical dimensions of the terminal,
and is used internally to calculate the maximum number of characters that
-may appear on the screen.
+may appear on a single line and on the screen.
@end deftypefun
If an application does not want to install a @code{SIGWINCH} handler, but
Words are composed of letters and digits.
@ifset BashFeatures
-@item shell-forward-word ()
+@item shell-forward-word (M-C-f)
Move forward to the end of the next word.
Words are delimited by non-quoted shell metacharacters.
-@item shell-backward-word ()
+@item shell-backward-word (M-C-b)
Move back to the start of the current or previous word.
Words are delimited by non-quoted shell metacharacters.
@end ifset
Word boundaries are the same as @code{backward-word}.
@ifset BashFeatures
-@item shell-kill-word ()
+@item shell-kill-word (M-C-d)
Kill from point to the end of the current word, or if between
words, to the end of the next word.
Word boundaries are the same as @code{shell-forward-word}.
Word boundaries are the same as @code{shell-backward-word}.
@end ifset
+@item shell-transpose-words (M-C-t)
+Drag the word before point past the word after point,
+moving point past that word as well.
+If the insertion point is at the end of the line, this transposes
+the last two words on the line.
+Word boundaries are the same as @code{shell-forward-word} and
+@code{shell-backward-word}.
+
@item unix-word-rubout (C-w)
Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
}
has_timestamps = HIST_TIMESTAMP_START (buffer);
- history_multiline_entries += has_timestamps && history_write_timestamps;
+ history_multiline_entries += has_timestamps && history_write_timestamps;
/* Skip lines until we are at FROM. */
+ if (has_timestamps)
+ last_ts = buffer;
for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
if (*line_end == '\n')
{
line. We should check more extensively here... */
if (HIST_TIMESTAMP_START(p) == 0)
current_line++;
+ else
+ last_ts = p;
line_start = p;
+ /* If we are at the last line (current_line == from) but we have
+ timestamps (has_timestamps), then line_start points to the
+ text of the last command, and we need to skip to its end. */
+ if (current_line >= from && has_timestamps)
+ {
+ for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++)
+ ;
+ line_start = (*line_end == '\n') ? line_end + 1 : line_end;
+ }
}
/* If there are lines left to gobble, then gobble them now. */
mb_len = 0;
while (mb_len < size)
{
- RL_SETSTATE(RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ c = (mb_len == 0) ? _rl_bracketed_read_key () : rl_read_key ();
if (c < 0)
break;
rl_clear_message ();
}
+/* XXX - we could use _rl_bracketed_read_mbstring () here. */
int
_rl_search_getchar (_rl_search_cxt *cxt)
{
/* kill.c -- kill ring management. */
-/* Copyright (C) 1994-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2019 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.
/* Having read the special escape sequence denoting the beginning of a
`bracketed paste' sequence, read the rest of the pasted input until the
- closing sequence and insert the pasted text as a single unit without
- interpretation. */
+ closing sequence and return the pasted text. */
char *
_rl_bracketed_text (size_t *lenp)
{
return (buf);
}
+/* Having read the special escape sequence denoting the beginning of a
+ `bracketed paste' sequence, read the rest of the pasted input until the
+ closing sequence and insert the pasted text as a single unit without
+ interpretation. */
int
rl_bracketed_paste_begin (int count, int key)
{
return (retval);
}
+int
+_rl_read_bracketed_paste_prefix (int c)
+{
+ char pbuf[BRACK_PASTE_SLEN+1], *pbpref;
+ int key, ind, j;
+
+ pbpref = BRACK_PASTE_PREF; /* XXX - debugging */
+ if (c != pbpref[0])
+ return (0);
+ pbuf[ind = 0] = c;
+ while (ind < BRACK_PASTE_SLEN-1 &&
+ (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
+ _rl_pushed_input_available () == 0 &&
+ _rl_input_queued (0))
+ {
+ key = rl_read_key (); /* XXX - for now */
+ if (key < 0)
+ break;
+ pbuf[++ind] = key;
+ if (pbuf[ind] != pbpref[ind])
+ break;
+ }
+
+ if (ind < BRACK_PASTE_SLEN-1) /* read incomplete sequence */
+ {
+ while (ind >= 0)
+ _rl_unget_char (pbuf[ind--]);
+ return (key < 0 ? key : 0);
+ }
+ return (key < 0 ? key : 1);
+}
+
+/* Get a character from wherever we read input, handling input in bracketed
+ paste mode. If we don't have or use bracketed paste mode, this can be
+ used in place of rl_read_key(). */
+int
+_rl_bracketed_read_key ()
+{
+ int c, r;
+ char *pbuf;
+ size_t pblen;
+
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+ if (c < 0)
+ return -1;
+
+ /* read pasted data with bracketed-paste mode enabled. */
+ if (_rl_enable_bracketed_paste && c == ESC && (r = _rl_read_bracketed_paste_prefix (c)) == 1)
+ {
+ pbuf = _rl_bracketed_text (&pblen);
+ if (pblen == 0)
+ {
+ xfree (pbuf);
+ return 0; /* XXX */
+ }
+ c = (unsigned char)pbuf[0];
+ if (pblen > 1)
+ {
+ while (--pblen > 0)
+ _rl_unget_char ((unsigned char)pbuf[pblen]);
+ }
+ xfree (pbuf);
+ }
+
+ return c;
+}
+
+/* Get a character from wherever we read input, handling input in bracketed
+ paste mode. If we don't have or use bracketed paste mode, this can be
+ used in place of rl_read_key(). */
+int
+_rl_bracketed_read_mbstring (char *mb, int mlen)
+{
+ int c, r;
+
+ c = _rl_bracketed_read_key ();
+ if (c < 0)
+ return -1;
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ c = _rl_read_mbstring (c, mb, mlen);
+#endif
+
+ return c;
+}
+
/* A special paste command for Windows users. */
#if defined (_WIN32)
#include <windows.h>
}
else
{
- RL_SETSTATE(RL_STATE_MOREINPUT);
- key = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ key = _rl_bracketed_read_key ();
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
rl_get_previous_history (int count, int key)
{
HIST_ENTRY *old_temp, *temp;
+ int had_saved_line;
if (count < 0)
return (rl_get_next_history (-count, key));
_rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
/* If we don't have a line saved, then save this one. */
+ had_saved_line = _rl_saved_line_for_history != 0;
rl_maybe_save_line ();
/* If the current line has changed, save the changes. */
if (temp == 0)
{
- _rl_free_saved_history_line ();
+ if (had_saved_line == 0)
+ _rl_free_saved_history_line ();
rl_ding ();
}
else
#define BRACK_PASTE_INIT "\033[?2004h"
#define BRACK_PASTE_FINI "\033[?2004l\r"
+extern int _rl_read_bracketed_paste_prefix PARAMS((int));
extern char *_rl_bracketed_text PARAMS((size_t *));
+extern int _rl_bracketed_read_key PARAMS((void));
+extern int _rl_bracketed_read_mbstring PARAMS((char *, int));
/* macro.c */
extern void _rl_with_macro_input PARAMS((char *));
SHLIB_STATUS=unsupported
# If you are using the HP ANSI C compiler, you can uncomment and use
- # this code (I have not tested it)
-# SHOBJ_STATUS=supported
-# SHLIB_STATUS=supported
-#
+ # this code from michael.osipov@siemens.com (I have not tested it)
# SHOBJ_CFLAGS='+z'
-# SHOBJ_LD='ld'
-# SHOBJ_LDFLAGS='-b +s +h $@'
+# SHOBJ_LD='$(CC)'
+# SHOBJ_LDFLAGS='-b -Wl,+s -Wl,+h,$@'
#
-# SHLIB_XLDFLAGS='+b $(libdir)'
-# SHLIB_LIBSUFF='sl'
+# SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
+# SHLIB_LIBSUFF='so'
# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
-
+# SHLIB_LIBS='$(TERMCAP_LIB)'
;;
sysv4*-*gcc*)
tgetent_ret = tgetent (term_buffer, term);
}
+#ifdef TGETENT_BROKEN
+ if (tgetent_ret < 0)
+#else
if (tgetent_ret <= 0)
+#endif
{
FREE (term_string_buffer);
FREE (term_buffer);
/* text.c -- text handling commands for readline. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 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.
{
int c;
- RL_SETSTATE(RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
+ c = _rl_bracketed_read_key ();
if (c < 0)
return 1;
/* vi_mode.c -- A vi emulation mode for Bash.
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
-/* Copyright (C) 1987-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 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.
static int
rl_vi_domove_getchar (_rl_vimotion_cxt *m)
{
- int c;
-
- RL_SETSTATE(RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
- return c;
+ return (_rl_bracketed_read_key ());
}
#if defined (READLINE_CALLBACKS)
static int
_rl_vi_callback_getchar (char *mb, int mlen)
{
- int c;
-
- RL_SETSTATE(RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
- if (c < 0)
- return -1;
-
-#if defined (HANDLE_MULTIBYTE)
- if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
- c = _rl_read_mbstring (c, mb, mlen);
-#endif
-
- return c;
+ return (_rl_bracketed_read_mbstring (mb, mlen));
}
#if defined (READLINE_CALLBACKS)
return (0);
}
+/* Read bracketed paste mode pasted text and insert it in overwrite mode */
+static int
+rl_vi_overstrike_bracketed_paste (int count, int key)
+{
+ int r;
+ char *pbuf;
+ size_t pblen;
+
+ pbuf = _rl_bracketed_text (&pblen);
+ if (pblen == 0)
+ {
+ xfree (pbuf);
+ return 0;
+ }
+ r = pblen;
+ while (--r >= 0)
+ _rl_unget_char ((unsigned char)pbuf[r]);
+ xfree (pbuf);
+
+ while (_rl_pushed_input_available ())
+ {
+ key = rl_read_key ();
+ r = rl_vi_overstrike (1, key);
+ }
+
+ return r;
+}
+
int
rl_vi_replace (int count, int key)
{
_rl_vi_last_key_before_insert = key;
_rl_keymap = vi_replace_map;
+ if (_rl_enable_bracketed_paste)
+ rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_vi_overstrike_bracketed_paste);
+
return (0);
}