fprintf (rl_outstream, "%s\n", text);
fprintf (rl_outstream, "%d:%d\n", start, end); /* : because it's not a radix character */
for (i = 0; i < len; i++)
- fprintf (rl_outstream, "%s\n", matches[i]);
+ {
+ print_filename (matches[i], matches[i], 0);
+ fprintf (rl_outstream, "\n");
+ }
fflush (rl_outstream);
}
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
+/* Define if you have the tcgetwinsize function. */
+#undef HAVE_TCGETWINSIZE
+
+/* Define if you have the tcsetwinsize function. */
+#undef HAVE_TCSETWINSIZE
+
/* Define if you have the towlower function. */
#undef HAVE_TOWLOWER
#! /bin/sh
-# From configure.ac for Readline 8.3, version 2.101.
+# From configure.ac for Readline 8.3, version 2.102.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for readline 8.3.
#
then :
printf "%s\n" "#define HAVE_TCGETATTR 1" >>confdefs.h
+fi
+ac_fn_c_check_func "$LINENO" "tcgetwinsize" "ac_cv_func_tcgetwinsize"
+if test "x$ac_cv_func_tcgetwinsize" = xyes
+then :
+ printf "%s\n" "#define HAVE_TCGETWINSIZE 1" >>confdefs.h
+
+fi
+ac_fn_c_check_func "$LINENO" "tcsetwinsize" "ac_cv_func_tcsetwinsize"
+if test "x$ac_cv_func_tcsetwinsize" = xyes
+then :
+ printf "%s\n" "#define HAVE_TCSETWINSIZE 1" >>confdefs.h
+
fi
ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
if test "x$ac_cv_func_vsnprintf" = xyes
fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_ino" >&5
-printf %s "checking for struct dirent.d_ino... " >&6; }
-if test ${bash_cv_dirent_has_d_ino+y}
-then :
- printf %s "(cached) " >&6
-else case e in #(
- e)
ac_fn_c_check_member "$LINENO" "struct dirent" "d_ino" "ac_cv_member_struct_dirent_d_ino" "
#include <stdio.h>
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_INO 1" >>confdefs.h
-bash_cv_dirent_has_d_ino=yes
-else case e in #(
- e) bash_cv_dirent_has_d_ino=no ;;
-esac
-fi
- ;;
-esac
fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_d_ino" >&5
-printf "%s\n" "$bash_cv_dirent_has_d_ino" >&6; }
-if test $bash_cv_dirent_has_d_ino = yes; then
-printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_INO 1" >>confdefs.h
-
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_fileno" >&5
-printf %s "checking for struct dirent.d_fileno... " >&6; }
-if test ${bash_cv_dirent_has_d_fileno+y}
-then :
- printf %s "(cached) " >&6
-else case e in #(
- e)
ac_fn_c_check_member "$LINENO" "struct dirent" "d_fileno" "ac_cv_member_struct_dirent_d_fileno" "
#include <stdio.h>
printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h
-bash_cv_dirent_has_d_fileno=yes
-else case e in #(
- e) bash_cv_dirent_has_d_fileno=no ;;
-esac
-fi
- ;;
-esac
fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_d_fileno" >&5
-printf "%s\n" "$bash_cv_dirent_has_d_fileno" >&6; }
-if test $bash_cv_dirent_has_d_fileno = yes; then
-printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h
-
-fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timeval in sys/time.h and time.h" >&5
printf %s "checking for struct timeval in sys/time.h and time.h... " >&6; }
# 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.3, version 2.101])
+AC_REVISION([for Readline 8.3, version 2.102])
AC_INIT(readline, 8.3, bug-readline@gnu.org)
AC_HEADER_DIRENT
AC_CHECK_FUNCS(fcntl gettimeofday kill lstat pselect readlink select setitimer)
-AC_CHECK_FUNCS(fnmatch memmove putenv setenv setlocale \
- strcasecmp strpbrk sysconf tcgetattr vsnprintf)
+AC_CHECK_FUNCS(fnmatch memmove putenv setenv setlocale strcasecmp \
+ strpbrk sysconf tcgetattr tcgetwinsize tcsetwinsize \
+ vsnprintf)
AC_CHECK_FUNCS(isascii isxdigit)
AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
but the buffer position needs to be adjusted to account
for invisible characters. */
if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == prompt_last_screen_line)
- _rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);;
+ _rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);
}
/* Now we move the cursor to where it needs to be. First, make
invisible character in the prompt string. */
/* XXX - why not use local_prompt_len? */
nleft = prompt_visible_length + wrap_offset;
- if (cursor_linenum == prompt_last_screen_line && wrap_offset > 0 &&
- _rl_last_c_pos > 0 && local_prompt &&
- _rl_last_c_pos < PROMPT_ENDING_INDEX)
+ if (cursor_linenum == prompt_last_screen_line)
{
- int pmt_offset;
-
- _rl_cr ();
- if (modmark)
- _rl_output_some_chars ("*", 1);
-
- /* If the number of characters in local_prompt is greater than
- the screen width, the prompt wraps. We only want to print the
- portion after the line wrap. */
- pmt_offset = local_prompt_newlines[cursor_linenum];
- if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset)
- _rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset);
- else
- _rl_output_some_chars (local_prompt, nleft);
- if (mb_cur_max > 1 && rl_byte_oriented == 0)
- _rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark;
+ int pmt_offset = local_prompt_newlines ? local_prompt_newlines[cursor_linenum] : 0;
+ int curline_invchars = local_prompt_invis_chars ? local_prompt_invis_chars[cursor_linenum] : wrap_offset;
+ int cursor_bufpos;
+
+ /* cursor_bufpos is where the portion of the prompt that appears
+ on the current screen line begins in the buffer. It is a
+ buffer position, an index into curline
+ (local_prompt + pmt_offset) */
+ cursor_bufpos = pmt_offset;
+ if (mb_cur_max == 1 || rl_byte_oriented)
+ cursor_bufpos += _rl_last_c_pos;
else
- _rl_last_c_pos = nleft + modmark; /* buffer position */
+ cursor_bufpos += _rl_last_c_pos + curline_invchars;
+
+ if (local_prompt && local_prompt_invis_chars[cursor_linenum] &&
+ _rl_last_c_pos > 0 &&
+ cursor_bufpos <= prompt_last_invisible)
+ {
+ _rl_cr ();
+ if (modmark)
+ _rl_output_some_chars ("*", 1);
+
+ /* If the number of characters in local_prompt is greater
+ than the screen width, the prompt wraps. We only want to
+ print the portion after the line wrap. */
+
+ /* Make sure we set _rl_last_c_pos based on the number of
+ characters we actually output, since we start at column 0. */
+ if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset)
+ _rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset);
+ else
+ {
+ _rl_output_some_chars (local_prompt, nleft);
+ pmt_offset = 0; /* force for calculation below */
+ }
+
+ if (mb_cur_max > 1 && rl_byte_oriented == 0)
+ /* Start width calculation where we started output. */
+ _rl_last_c_pos = _rl_col_width (local_prompt, pmt_offset, nleft, 1) - WRAP_OFFSET(cursor_linenum, wrap_offset) + modmark;
+ else
+ /* Index into invisible_line+inv_lbreaks[cursor_linenum],
+ since that's what we use in the call to
+ _rl_move_cursor_relative below. */
+ _rl_last_c_pos = nleft + modmark - inv_lbreaks[cursor_linenum]; /* buffer position */
+ }
}
/* Where on that line? And where does that line start
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Fri Nov 29 18:17:58 EST 2024
+.\" Last Change: Tue Dec 31 13:35:52 EST 2024
.\"
-.TH HISTORY 3 "2024 November 29" "GNU History 8.3"
+.TH HISTORY 3 "2024 December 31" "GNU History 8.3"
.\"
.ie \n(.g \{\
.ds ' \(aq
.SH NAME
history \- GNU History Library
.SH COPYRIGHT
-.if t The GNU History Library is Copyright \(co 1989-2024 by the Free Software Foundation, Inc.
-.if n The GNU History Library is Copyright (C) 1989-2024 by the Free Software Foundation, Inc.
+.if t The GNU History Library is Copyright \(co 1989-2025 by the Free Software Foundation, Inc.
+.if n The GNU History Library is Copyright (C) 1989-2025 by the Free Software Foundation, Inc.
.SH DESCRIPTION
Many programs read input from the user a line at a time.
The GNU
.F1 int unstifle_history "void"
Stop stifling the history. This returns the previously-set
maximum number of history entries (as set by \fBstifle_history()\fP).
-history was stifled. The value is positive if the history was
+history was stifled.
+The value is positive if the history was
stifled, negative if it wasn't.
.PP
.F1 int history_is_stifled "void"
-\input texinfo @c -*-texinfo-*-
+c\input texinfo @c -*-texinfo-*-
@c %**start of header (This is for running Texinfo on a region.)
@setfilename history.info
@settitle GNU History Library
a programming tool that provides a consistent user interface for
recalling lines of previously typed input.
-Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@ignore
This file documents the user interface to the GNU History library.
-Copyright (C) 1988-2024 Free Software Foundation, Inc.
+Copyright (C) 1988-2025 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
* Introduction to History:: What is the GNU History library for?
* History Storage:: How information is stored.
* History Functions:: Functions that you can use.
-* History Variables:: Variables that control behaviour.
+* History Variables:: Variables that control behavior.
* History Programming Example:: Example of using the GNU History Library.
@end menu
@ignore
This file documents the user interface to the GNU History library.
-Copyright (C) 1988--2024 Free Software Foundation, Inc.
+Copyright (C) 1988--2025 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@samp{*}, @samp{-}, or @samp{%}.
Words are numbered from the beginning of the line,
with the first word being denoted by 0 (zero).
+That first word is usually the command word, and the arguments begin
+with the second word.
Words are inserted into the current line separated by single spaces.
@need 0.75
When you type this, the preceding command is repeated in toto.
@item !!:$
-designates the last argument of the preceding command.
+designates the last word of the preceding command.
This may be shortened to @code{!$}.
@item !fi:2
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Fri Nov 29 18:17:27 EST 2024
+.\" Last Change: Mon Dec 30 11:27:47 EST 2024
.\"
-.TH READLINE 3 "2024 November 29" "GNU Readline 8.3"
+.TH READLINE 3 "2024 December 30" "GNU Readline 8.3"
.\"
.ie \n(.g \{\
.ds ' \(aq
\fBreadline\fP (\fIconst char *prompt\fP);
.fi
.SH COPYRIGHT
-.if n Readline is Copyright (C) 1989\-2024 Free Software Foundation, Inc.
-.if t Readline is Copyright \(co 1989\-2024 Free Software Foundation, Inc.
+.if n Readline is Copyright (C) 1989\-2025 Free Software Foundation, Inc.
+.if t Readline is Copyright \(co 1989\-2025 Free Software Foundation, Inc.
.SH DESCRIPTION
.LP
.B readline
.TP
.B transpose\-words (M\-t)
Drag the word before point past the word after point,
-moving point over that word as well.
+moving point past that word as well.
If point is at the end of the line, this transposes
the last two words on the line.
.TP
the word being completed;
.IP \(bu
\fIS\fP:\fIE\fP,
-where S and E are the start and end offsets of the word
+where \fIS\fP and \fIE\fP are the start and end offsets of the word
in the \fBreadline\fP line buffer; then
.IP \(bu
each match, one per line
consistency of user interface across discrete programs which provide
a command line interface.
-Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
in the consistency of user interface across discrete programs that need
to provide a command line interface.
-Copyright (C) 1988--2024 Free Software Foundation, Inc.
+Copyright (C) 1988--2025 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
Many programs provide a command line interface, such as @code{mail},
@code{ftp}, and @code{sh}.
-For such programs, the default behaviour of Readline is sufficient.
+For such programs, the default behavior of Readline is sufficient.
This section describes how to use Readline in
the simplest way possible, perhaps to replace calls in your code to
@code{fgets()}.
@}
@end example
-This function gives the user the default behaviour of @key{TAB}
+This function gives the user the default behavior of @key{TAB}
completion: filename completion.
If you do not want Readline to
complete filenames, you can change the binding of the @key{TAB} key
@deftypefun void rl_free_keymap (Keymap keymap)
Free all storage associated with @var{keymap}.
-This calls @code{rl_discard_keymap} to free subordindate
+This calls @code{rl_discard_keymap} to free subordinate
keymaps and macros.
@end deftypefun
@deftypefun void rl_restore_prompt (void)
Restore the local Readline prompt display state saved by the most
recent call to @code{rl_save_prompt}.
-if you called @code{rl_save_prompt} to save the prompt before a call
+If you called @code{rl_save_prompt} to save the prompt before a call
to @code{rl_message}, you should call this function before the
corresponding call to @code{rl_clear_message}.
@end deftypefun
which contains both end-user and programmer documentation for the
GNU Readline Library.
-Copyright (C) 1988--2024 Free Software Foundation, Inc.
+Copyright (C) 1988--2025 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@item active-region-end-color
@vindex active-region-end-color
-A string variable that "undoes" the effects of @code{active-region-start-color}
-and restores "normal" terminal display appearance after displaying text
-in the active region.
+A string variable that ``undoes''
+the effects of @code{active-region-start-color}
+and restores ``normal''
+terminal display appearance after displaying text in the active region.
This string must not take up any physical character positions on the display,
so it should consist only of terminal escape sequences.
It is output to the terminal after displaying the text in the active region.
If set to a value less than zero, the number of history entries is not
limited.
@ifset BashFeatures
-By default, Bash sets the the maximum number of history entries to
+By default, Bash sets the maximum number of history entries to
the value of the @code{HISTSIZE} shell variable.
@end ifset
@ifclear BashFeatures
When entering the text of a macro, single or double quotes must
be used to indicate a macro definition.
Unquoted text is assumed to be a function name.
-Tthe backslash escapes described above are expanded
+The backslash escapes described above are expanded
in the macro body.
Backslash will quote any other character in the macro text,
including @samp{"} and @samp{'}.
@example
@page
-# This file controls the behaviour of line input editing for
+# This file controls the behavior of line input editing for
# programs that use the GNU Readline library. Existing
# programs include FTP, Bash, and GDB.
#
position, and @dfn{mark} refers to a cursor position saved by the
@code{set-mark} command.
The text between the point and mark is referred to as the @dfn{region}.
-Readline has the concept of an @emph{active region}:
+Readline
+has the concept of an @emph{active region}:
when the region is active,
Readline redisplay highlights the region using the
-value of the @code{active-region-start-color} variable.
+value of the
+@code{active-region-start-color}
+variable.
The @code{enable-active-region} variable turns this on and off.
Several commands set the region to active; those are noted below.
the word being completed;
@item
@var{S}:@var{E},
-where S and E are the start and end offsets of the word
+where @var{S} and @var{E} are the start and end offsets of the word
in the Readline line buffer; then
@item
each match, one per line
This performs alias and history expansion,
$'@var{string}' and $"@var{string}" quoting,
tilde expansion, parameter and variable expansion, arithmetic expansion,
-command and proces substitution,
+command and process substitution,
word splitting, and quote removal.
An explicit argument suppresses command and process substitution.
consistency of user interface across discrete programs which provide
a command line interface.
-Copyright @copyright{} 1988--2024 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2025 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@ignore
-Copyright (C) 1988-2024 Free Software Foundation, Inc.
+Copyright (C) 1988-2025 Free Software Foundation, Inc.
@end ignore
@set EDITION 8.3
@set VERSION 8.3
-@set UPDATED 29 November 2024
-@set UPDATED-MONTH November 2024
+@set UPDATED 30 December 2024
+@set UPDATED-MONTH December 2024
-@set LASTCHANGE Fri Nov 29 18:18:20 EST 2024
+@set LASTCHANGE Mon Dec 30 11:27:03 EST 2024
register char c;
HIST_ENTRY *entry;
int which, sign, local_index, substring_okay;
- int search_flags;
+ int search_flags, old_offset;
char *temp;
/* The event can be specified in a number of ways.
*caller_index = i;
+ old_offset = history_offset; /* XXX */
#define FAIL_SEARCH() \
do { \
- history_offset = history_length; xfree (temp) ; return (char *)NULL; \
+ history_offset = old_offset; xfree (temp) ; return (char *)NULL; \
} while (0)
/* If there is no search string, try to use the previous search string,
entry = current_history ();
if (entry == 0)
FAIL_SEARCH ();
- history_offset = history_length;
+ history_offset = old_offset; /* XXX - was history_length */
/* If this was a substring search, then remember the
string that we matched for word substitution. */
/* signals.c */
extern int volatile _rl_caught_signal;
+extern int volatile _rl_handling_signal;
extern _rl_sigcleanup_func_t *_rl_sigcleanup;
extern void *_rl_sigcleanarg;
#endif
/* Dummy call to force a backgrounded readline to stop before it tries
- to get the tty settings. */
+ to get the tty settings. But we use the information to set our idea
+ of the screen size if we're in a signal handling context, since it
+ doesn't make sense to waste it. */
static void
set_winsize (int tty)
{
-#if defined (TIOCGWINSZ)
+#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
struct winsize w;
-
- if (ioctl (tty, TIOCGWINSZ, &w) == 0)
- (void) ioctl (tty, TIOCSWINSZ, &w);
+
+ if (_rl_tcgetwinsize (tty, &w) == 0)
+ {
+ (void) _rl_tcsetwinsize (tty, &w);
+ /* We restrict this to the case where we're running a signal handler
+ and executing after a SIGTSTP. We can relax it later. */
+#if defined (SIGTSTP)
+ if (RL_ISSTATE (RL_STATE_SIGHANDLER) && _rl_handling_signal == SIGTSTP && rl_prefer_env_winsize == 0)
+ _rl_set_screen_size (w.ws_row, w.ws_col); /* don't waste the info */
+#endif
+ }
#endif /* TIOCGWINSZ */
}
# define tcflow(fd, action) ioctl(fd, TCXONC, action)
#endif
+extern int _rl_tcgetwinsize (int, struct winsize *);
+extern void _rl_tcsetwinsize (int, struct winsize *);
+
#endif /* _RL_WINSIZE_H */
/* Private variables. */
int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including <signal.h> everywhere */
+int volatile _rl_handling_signal = 0;
/* If non-zero, print characters corresponding to received signals as long as
the user has indicated his desire to do so (_rl_echo_control_chars). */
if (sig == SIGWINCH)
{
RL_SETSTATE(RL_STATE_SIGHANDLER);
+ _rl_handling_signal = SIGWINCH;
rl_resize_terminal ();
/* XXX - experimental for now */
if (rl_signal_event_hook)
(*rl_signal_event_hook) ();
+ _rl_handling_signal = 0;
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
}
else
#endif /* !HAVE_POSIX_SIGNALS */
RL_SETSTATE(RL_STATE_SIGHANDLER);
+ _rl_handling_signal = sig;
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
/* Since the signal will not be blocked while we are in the signal
rl_reset_after_signal ();
}
+ _rl_handling_signal = 0;
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
SIGHANDLER_RETURN;
}
}
#endif
+int
+_rl_tcgetwinsize (int tty, struct winsize *wp)
+{
+#if defined (HAVE_TCGETWINSIZE)
+ return (tcgetwinsize (tty, wp));
+#elif defined (TIOCGWINSZ)
+ return (ioctl (tty, TIOCGWINSZ, wp));
+#else
+ return -1;
+#endif
+}
+
+void
+_rl_tcsetwinsize (int tty, struct winsize *wp)
+{
+#if defined (HAVE_TCGETWINSIZE)
+ tcsetwinsize (tty, wp);
+#elif defined (TIOCGWINSZ)
+ ioctl (tty, TIOCSWINSZ, wp);
+#else
+ ;
+#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
_rl_get_screen_size (int tty, int ignore_env)
{
char *ss;
-#if defined (TIOCGWINSZ)
+#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
struct winsize window_size;
-#endif /* TIOCGWINSZ */
+#endif /* TIOCGWINSZ || HAVE_TCGETWINSIZE */
int wr, wc;
wr = wc = -1;
-#if defined (TIOCGWINSZ)
- if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
+#if defined (TIOCGWINSZ) || defined (HAVE_TCGETWINSIZE)
+ if (_rl_tcgetwinsize (tty, &window_size) == 0)
{
wc = (int) window_size.ws_col;
wr = (int) window_size.ws_row;
}
-#endif /* TIOCGWINSZ */
+#endif /* TIOCGWINSZ || HAVE_TCGETWINSIZE */
#if defined (__EMX__)
_emx_get_screensize (&wc, &wr);
RL_UNSETSTATE (RL_STATE_MULTIKEY); /* XXX */
rl_last_func = (rl_command_func_t *)NULL;
+ _rl_command_to_execute = 0;
_rl_longjmp (_rl_top_level, 1);
return (0);