merge
This commit is contained in:
parent
86cebc981d
commit
3d8a49c301
@ -1,16 +0,0 @@
|
||||
#
|
||||
# Master Manifest file for documentation-only distribution
|
||||
#
|
||||
doc d
|
||||
MANIFEST.doc f
|
||||
doc/readline.ps f
|
||||
doc/history.ps f
|
||||
doc/readline.dvi f
|
||||
doc/history.dvi f
|
||||
doc/readline.info f
|
||||
doc/history.info f
|
||||
doc/readline.html f
|
||||
doc/readline_toc.html f
|
||||
doc/history.html f
|
||||
doc/history_toc.html f
|
||||
doc/readline.0 f
|
@ -85,6 +85,15 @@ extern void _rl_move_vert ();
|
||||
extern int _rl_vis_botlin;
|
||||
extern int rl_display_fixed;
|
||||
|
||||
/* If non-zero, then this is the address of a function to call when
|
||||
completing a word would normally display the list of possible matches.
|
||||
This function is called instead of actually doing the display.
|
||||
It takes three arguments: (char **matches, int num_matches, int max_length)
|
||||
where MATCHES is the array of strings that matched, NUM_MATCHES is the
|
||||
number of strings in that array, and MAX_LENGTH is the length of the
|
||||
longest string in that array. */
|
||||
VFunction *rl_completion_display_matches_hook = (VFunction *)NULL;
|
||||
|
||||
/* Forward declarations for functions defined and used in this file. */
|
||||
char *filename_completion_function ();
|
||||
char **completion_matches ();
|
||||
@ -674,6 +683,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
|
||||
we are doing filename completion and the application has defined a
|
||||
filename dequoting function. */
|
||||
temp = (char *)NULL;
|
||||
|
||||
if (found_quote && our_func == (Function *)filename_completion_function &&
|
||||
rl_filename_dequoting_function)
|
||||
{
|
||||
@ -682,7 +692,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
|
||||
text = temp; /* not freeing text is not a memory leak */
|
||||
}
|
||||
|
||||
matches = completion_matches (text, our_func);
|
||||
matches = completion_matches (text, (CPFunction *)our_func);
|
||||
FREE (temp);
|
||||
return matches;
|
||||
}
|
||||
@ -813,8 +823,7 @@ compute_lcd_of_matches (match_list, matches, text)
|
||||
}
|
||||
|
||||
static int
|
||||
postprocess_matches (text, matchesp, matching_filenames)
|
||||
char *text;
|
||||
postprocess_matches (matchesp, matching_filenames)
|
||||
char ***matchesp;
|
||||
int matching_filenames;
|
||||
{
|
||||
@ -845,7 +854,6 @@ postprocess_matches (text, matchesp, matching_filenames)
|
||||
if (matches == 0 || matches[0] == 0)
|
||||
{
|
||||
FREE (matches);
|
||||
ding ();
|
||||
*matchesp = (char **)0;
|
||||
return 0;
|
||||
}
|
||||
@ -857,7 +865,7 @@ postprocess_matches (text, matchesp, matching_filenames)
|
||||
if (i > 1 && i < nmatch)
|
||||
{
|
||||
t = matches[0];
|
||||
compute_lcd_of_matches (matches, i - 1, text);
|
||||
compute_lcd_of_matches (matches, i - 1, t);
|
||||
FREE (t);
|
||||
}
|
||||
}
|
||||
@ -867,66 +875,19 @@ postprocess_matches (text, matchesp, matching_filenames)
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
display_matches (matches)
|
||||
/* A convenience function for displaying a list of strings in
|
||||
columnar format on readline's output stream. MATCHES is the list
|
||||
of strings, in argv format, LEN is the number of strings in MATCHES,
|
||||
and MAX is the length of the longest string in MATCHES. */
|
||||
void
|
||||
rl_display_match_list (matches, len, max)
|
||||
char **matches;
|
||||
int len, max;
|
||||
{
|
||||
int len, count, limit, max, printed_len;
|
||||
int count, limit, printed_len;
|
||||
int i, j, k, l;
|
||||
char *temp;
|
||||
|
||||
/* Move to the last visible line of a possibly-multiple-line command. */
|
||||
_rl_move_vert (_rl_vis_botlin);
|
||||
|
||||
/* Handle simple case first. What if there is only one answer? */
|
||||
if (matches[1] == 0)
|
||||
{
|
||||
temp = printable_part (matches[0]);
|
||||
crlf ();
|
||||
print_filename (temp, matches[0]);
|
||||
crlf ();
|
||||
#if 0
|
||||
rl_on_new_line ();
|
||||
#else
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/* There is more than one answer. Find out how many there are,
|
||||
and find the maximum printed length of a single entry. */
|
||||
for (max = 0, i = 1; matches[i]; i++)
|
||||
{
|
||||
temp = printable_part (matches[i]);
|
||||
len = strlen (temp);
|
||||
|
||||
if (len > max)
|
||||
max = len;
|
||||
}
|
||||
|
||||
len = i - 1;
|
||||
|
||||
/* If there are many items, then ask the user if she really wants to
|
||||
see them all. */
|
||||
if (len >= rl_completion_query_items)
|
||||
{
|
||||
crlf ();
|
||||
fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len);
|
||||
fflush (rl_outstream);
|
||||
if (get_y_or_n () == 0)
|
||||
{
|
||||
crlf ();
|
||||
#if 0
|
||||
rl_on_new_line ();
|
||||
#else
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* How many items of MAX length can we fit in the screen window? */
|
||||
max += 2;
|
||||
limit = screenwidth / max;
|
||||
@ -993,13 +954,85 @@ display_matches (matches)
|
||||
}
|
||||
crlf ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Display MATCHES, a list of matching filenames in argv format. This
|
||||
handles the simple case -- a single match -- first. If there is more
|
||||
than one match, we compute the number of strings in the list and the
|
||||
length of the longest string, which will be needed by the display
|
||||
function. If the application wants to handle displaying the list of
|
||||
matches itself, it sets RL_COMPLETION_DISPLAY_MATCHES_HOOK to the
|
||||
address of a function, and we just call it. If we're handling the
|
||||
display ourselves, we just call rl_display_match_list. We also check
|
||||
that the list of matches doesn't exceed the user-settable threshold,
|
||||
and ask the user if he wants to see the list if there are more matches
|
||||
than RL_COMPLETION_QUERY_ITEMS. */
|
||||
static void
|
||||
display_matches (matches)
|
||||
char **matches;
|
||||
{
|
||||
int len, max, i;
|
||||
char *temp;
|
||||
|
||||
/* Move to the last visible line of a possibly-multiple-line command. */
|
||||
_rl_move_vert (_rl_vis_botlin);
|
||||
|
||||
/* Handle simple case first. What if there is only one answer? */
|
||||
if (matches[1] == 0)
|
||||
{
|
||||
temp = printable_part (matches[0]);
|
||||
crlf ();
|
||||
print_filename (temp, matches[0]);
|
||||
crlf ();
|
||||
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* There is more than one answer. Find out how many there are,
|
||||
and find the maximum printed length of a single entry. */
|
||||
for (max = 0, i = 1; matches[i]; i++)
|
||||
{
|
||||
temp = printable_part (matches[i]);
|
||||
len = strlen (temp);
|
||||
|
||||
if (len > max)
|
||||
max = len;
|
||||
}
|
||||
|
||||
len = i - 1;
|
||||
|
||||
/* If the caller has defined a display hook, then call that now. */
|
||||
if (rl_completion_display_matches_hook)
|
||||
{
|
||||
(*rl_completion_display_matches_hook) (matches, len, max);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If there are many items, then ask the user if she really wants to
|
||||
see them all. */
|
||||
if (len >= rl_completion_query_items)
|
||||
{
|
||||
crlf ();
|
||||
fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len);
|
||||
fflush (rl_outstream);
|
||||
if (get_y_or_n () == 0)
|
||||
{
|
||||
crlf ();
|
||||
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rl_display_match_list (matches, len, max);
|
||||
|
||||
#if 0
|
||||
rl_on_new_line ();
|
||||
#else
|
||||
rl_forced_update_display ();
|
||||
rl_display_fixed = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -1026,11 +1059,8 @@ make_quoted_replacement (match, mtype, qc)
|
||||
rl_filename_quoting_desired;
|
||||
|
||||
if (should_quote)
|
||||
#if defined (SHELL)
|
||||
should_quote = should_quote && (!qc || !*qc || *qc == '"' || *qc == '\'');
|
||||
#else /* !SHELL */
|
||||
should_quote = should_quote && (!qc || !*qc);
|
||||
#endif /* !SHELL */
|
||||
should_quote = should_quote && (!qc || !*qc ||
|
||||
(rl_completer_quote_characters && strchr (rl_completer_quote_characters, *qc)));
|
||||
|
||||
if (should_quote)
|
||||
{
|
||||
@ -1168,6 +1198,17 @@ insert_all_matches (matches, point, qc)
|
||||
rl_end_undo_group ();
|
||||
}
|
||||
|
||||
static void
|
||||
free_match_list (matches)
|
||||
char **matches;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; matches[i]; i++)
|
||||
free (matches[i]);
|
||||
free (matches);
|
||||
}
|
||||
|
||||
/* Complete the word at or before point.
|
||||
WHAT_TO_DO says what to do with the completion.
|
||||
`?' means list the possible completions.
|
||||
@ -1210,27 +1251,34 @@ rl_complete_internal (what_to_do)
|
||||
|
||||
text = rl_copy_text (start, end);
|
||||
matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
|
||||
free (text);
|
||||
|
||||
if (matches == 0)
|
||||
{
|
||||
ding ();
|
||||
FREE (saved_line_buffer);
|
||||
free (text);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* If we are matching filenames, our_func will have been set to
|
||||
filename_completion_function */
|
||||
i = our_func == (Function *)filename_completion_function;
|
||||
if (postprocess_matches (text, &matches, i) == 0)
|
||||
#else
|
||||
/* If we are matching filenames, the attempted completion function will
|
||||
have set rl_filename_completion_desired to a non-zero value. The basic
|
||||
filename_completion_function does this. */
|
||||
i = rl_filename_completion_desired;
|
||||
#endif
|
||||
|
||||
if (postprocess_matches (&matches, i) == 0)
|
||||
{
|
||||
ding ();
|
||||
FREE (saved_line_buffer);
|
||||
free (text);
|
||||
completion_changed_buffer = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
free (text);
|
||||
|
||||
switch (what_to_do)
|
||||
{
|
||||
case TAB:
|
||||
@ -1277,9 +1325,7 @@ rl_complete_internal (what_to_do)
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; matches[i]; i++)
|
||||
free (matches[i]);
|
||||
free (matches);
|
||||
free_match_list (matches);
|
||||
|
||||
/* Check to see if the line has changed through all of this manipulation. */
|
||||
if (saved_line_buffer)
|
||||
@ -1358,10 +1404,10 @@ completion_matches (text, entry_function)
|
||||
character (usually `~'). */
|
||||
char *
|
||||
username_completion_function (text, state)
|
||||
int state;
|
||||
char *text;
|
||||
int state;
|
||||
{
|
||||
#if defined (__GO32__) || defined (__WIN32__)
|
||||
#if defined (__GO32__) || defined (__WIN32__) || defined (__OPENNT)
|
||||
return (char *)NULL;
|
||||
#else /* !__GO32__ */
|
||||
static char *username = (char *)NULL;
|
||||
@ -1415,8 +1461,8 @@ username_completion_function (text, state)
|
||||
completion for a command. */
|
||||
char *
|
||||
filename_completion_function (text, state)
|
||||
int state;
|
||||
char *text;
|
||||
int state;
|
||||
{
|
||||
static DIR *directory = (DIR *)NULL;
|
||||
static char *filename = (char *)NULL;
|
||||
@ -1574,7 +1620,7 @@ filename_completion_function (text, state)
|
||||
strcpy (temp, users_dirname);
|
||||
}
|
||||
|
||||
strcpy (temp + dirlen, entry->d_name); /* strcat (temp, entry->d_name); */
|
||||
strcpy (temp + dirlen, entry->d_name);
|
||||
}
|
||||
else
|
||||
temp = savestring (entry->d_name);
|
||||
@ -1649,10 +1695,17 @@ rl_menu_complete (count, ignore)
|
||||
matches = gen_completion_matches (orig_text, orig_start, orig_end,
|
||||
our_func, found_quote, quote_char);
|
||||
|
||||
#if 0
|
||||
/* If we are matching filenames, our_func will have been set to
|
||||
filename_completion_function */
|
||||
matching_filenames = our_func == (Function *)filename_completion_function;
|
||||
if (matches == 0 || postprocess_matches (orig_text, &matches, matching_filenames) == 0)
|
||||
#else
|
||||
/* If we are matching filenames, the attempted completion function will
|
||||
have set rl_filename_completion_desired to a non-zero value. The basic
|
||||
filename_completion_function does this. */
|
||||
matching_filenames = rl_filename_completion_desired;
|
||||
#endif
|
||||
if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
|
||||
{
|
||||
ding ();
|
||||
FREE (matches);
|
||||
@ -1686,7 +1739,7 @@ rl_menu_complete (count, ignore)
|
||||
if (match_list_index < 0)
|
||||
match_list_index += match_list_size;
|
||||
|
||||
if (match_list_index == 0)
|
||||
if (match_list_index == 0 && match_list_size > 1)
|
||||
{
|
||||
ding ();
|
||||
insert_match (orig_text, orig_start, MULT_MATCH, "e_char);
|
||||
|
@ -280,7 +280,7 @@ rl_expand_prompt (prompt)
|
||||
if (local_prompt_prefix)
|
||||
free (local_prompt_prefix);
|
||||
local_prompt = local_prompt_prefix = (char *)0;
|
||||
last_invisible = 0;
|
||||
last_invisible = visible_length = 0;
|
||||
|
||||
if (prompt == 0 || *prompt == 0)
|
||||
return (0);
|
||||
@ -373,6 +373,13 @@ rl_redisplay ()
|
||||
|
||||
if (local_len > 0)
|
||||
{
|
||||
temp = local_len + out + 2;
|
||||
if (temp >= line_size)
|
||||
{
|
||||
line_size = (temp + 1024) - (temp % 1024);
|
||||
visible_line = xrealloc (visible_line, line_size);
|
||||
line = invisible_line = xrealloc (invisible_line, line_size);
|
||||
}
|
||||
strncpy (line + out, local_prompt, local_len);
|
||||
out += local_len;
|
||||
}
|
||||
@ -399,6 +406,13 @@ rl_redisplay ()
|
||||
}
|
||||
|
||||
pmtlen = strlen (prompt_this_line);
|
||||
temp = pmtlen + out + 2;
|
||||
if (temp >= line_size)
|
||||
{
|
||||
line_size = (temp + 1024) - (temp % 1024);
|
||||
visible_line = xrealloc (visible_line, line_size);
|
||||
line = invisible_line = xrealloc (invisible_line, line_size);
|
||||
}
|
||||
strncpy (line + out, prompt_this_line, pmtlen);
|
||||
out += pmtlen;
|
||||
line[out] = '\0';
|
||||
@ -407,12 +421,12 @@ rl_redisplay ()
|
||||
|
||||
#define CHECK_LPOS() \
|
||||
do { \
|
||||
lpos++; \
|
||||
if (lpos >= screenwidth) \
|
||||
{ \
|
||||
inv_lbreaks[++newlines] = out; \
|
||||
lpos = 0; \
|
||||
} \
|
||||
lpos++; \
|
||||
if (lpos >= screenwidth) \
|
||||
{ \
|
||||
inv_lbreaks[++newlines] = out; \
|
||||
lpos = 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* inv_lbreaks[i] is where line i starts in the buffer. */
|
||||
@ -427,8 +441,8 @@ rl_redisplay ()
|
||||
temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
|
||||
#else
|
||||
/* XXX - possible fix from Darin Johnson <darin@acuson.com> for prompt
|
||||
string with invisible characters that is longer than the screen
|
||||
width. */
|
||||
string with invisible characters that is longer than the screen
|
||||
width. */
|
||||
temp = ((newlines + 1) * screenwidth) + ((newlines == 0) ? wrap_offset : 0);
|
||||
#endif
|
||||
inv_lbreaks[++newlines] = temp;
|
||||
@ -481,7 +495,12 @@ rl_redisplay ()
|
||||
else if (c == '\t')
|
||||
{
|
||||
register int temp, newout;
|
||||
|
||||
#if 0
|
||||
newout = (out | (int)7) + 1;
|
||||
#else
|
||||
newout = out + 8 - lpos % 8;
|
||||
#endif
|
||||
temp = newout - out;
|
||||
if (lpos + temp >= screenwidth)
|
||||
{
|
||||
@ -501,11 +520,11 @@ rl_redisplay ()
|
||||
}
|
||||
#endif
|
||||
else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && term_up && *term_up)
|
||||
{
|
||||
line[out++] = '\0'; /* XXX - sentinel */
|
||||
inv_lbreaks[++newlines] = out;
|
||||
lpos = 0;
|
||||
}
|
||||
{
|
||||
line[out++] = '\0'; /* XXX - sentinel */
|
||||
inv_lbreaks[++newlines] = out;
|
||||
lpos = 0;
|
||||
}
|
||||
else if (CTRL_CHAR (c) || c == RUBOUT)
|
||||
{
|
||||
line[out++] = '^';
|
||||
@ -616,11 +635,11 @@ rl_redisplay ()
|
||||
{
|
||||
_rl_move_vert (cursor_linenum);
|
||||
/* If we moved up to the line with the prompt using term_up,
|
||||
the physical cursor position on the screen stays the same,
|
||||
but the buffer position needs to be adjusted to account
|
||||
for invisible characters. */
|
||||
the physical cursor position on the screen stays the same,
|
||||
but the buffer position needs to be adjusted to account
|
||||
for invisible characters. */
|
||||
if (cursor_linenum == 0 && wrap_offset)
|
||||
_rl_last_c_pos += wrap_offset;
|
||||
_rl_last_c_pos += wrap_offset;
|
||||
}
|
||||
|
||||
/* We have to reprint the prompt if it contains invisible
|
||||
@ -673,16 +692,16 @@ rl_redisplay ()
|
||||
ndisp = c_pos - wrap_offset;
|
||||
nleft = visible_length + wrap_offset;
|
||||
/* Where the new cursor position will be on the screen. This can be
|
||||
longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
|
||||
longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
|
||||
phys_c_pos = c_pos - (last_lmargin ? last_lmargin : wrap_offset);
|
||||
t = screenwidth / 3;
|
||||
|
||||
/* If the number of characters had already exceeded the screenwidth,
|
||||
last_lmargin will be > 0. */
|
||||
last_lmargin will be > 0. */
|
||||
|
||||
/* If the number of characters to be displayed is more than the screen
|
||||
width, compute the starting offset so that the cursor is about
|
||||
two-thirds of the way across the screen. */
|
||||
width, compute the starting offset so that the cursor is about
|
||||
two-thirds of the way across the screen. */
|
||||
if (phys_c_pos > screenwidth - 2)
|
||||
{
|
||||
lmargin = c_pos - (2 * t);
|
||||
@ -694,7 +713,7 @@ rl_redisplay ()
|
||||
lmargin = nleft;
|
||||
}
|
||||
else if (ndisp < screenwidth - 2) /* XXX - was -1 */
|
||||
lmargin = 0;
|
||||
lmargin = 0;
|
||||
else if (phys_c_pos < 1)
|
||||
{
|
||||
/* If we are moving back towards the beginning of the line and
|
||||
@ -704,7 +723,7 @@ rl_redisplay ()
|
||||
lmargin = nleft;
|
||||
}
|
||||
else
|
||||
lmargin = last_lmargin;
|
||||
lmargin = last_lmargin;
|
||||
|
||||
/* If the first character on the screen isn't the first character
|
||||
in the display line, indicate this with a special character. */
|
||||
@ -712,12 +731,12 @@ rl_redisplay ()
|
||||
line[lmargin] = '<';
|
||||
|
||||
/* If SCREENWIDTH characters starting at LMARGIN do not encompass
|
||||
the whole line, indicate that with a special characters at the
|
||||
right edge of the screen. If LMARGIN is 0, we need to take the
|
||||
wrap offset into account. */
|
||||
the whole line, indicate that with a special character at the
|
||||
right edge of the screen. If LMARGIN is 0, we need to take the
|
||||
wrap offset into account. */
|
||||
t = lmargin + M_OFFSET (lmargin, wrap_offset) + screenwidth;
|
||||
if (t < out)
|
||||
line[t - 1] = '>';
|
||||
line[t - 1] = '>';
|
||||
|
||||
if (!rl_display_fixed || forced_display || lmargin != last_lmargin)
|
||||
{
|
||||
@ -782,7 +801,7 @@ new: eddie> Oh, my little buggy says to me, as lurgid as
|
||||
\new first difference
|
||||
|
||||
All are character pointers for the sake of speed. Special cases for
|
||||
no differences, as well as for end of line additions must be handeled.
|
||||
no differences, as well as for end of line additions must be handled.
|
||||
|
||||
Could be made even smarter, but this works well enough */
|
||||
static void
|
||||
@ -810,7 +829,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
_rl_last_c_pos = 1; /* XXX */
|
||||
_rl_last_v_pos++;
|
||||
if (old[0] && new[0])
|
||||
old[0] = new[0];
|
||||
old[0] = new[0];
|
||||
}
|
||||
|
||||
/* Find first difference. */
|
||||
@ -895,10 +914,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
lendiff needs to be adjusted. */
|
||||
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
|
||||
current_invis_chars != visible_wrap_offset)
|
||||
{
|
||||
temp = visible_wrap_offset - current_invis_chars;
|
||||
lendiff += temp;
|
||||
}
|
||||
lendiff += visible_wrap_offset - current_invis_chars;
|
||||
|
||||
/* Insert (diff (len (old), len (new)) ch. */
|
||||
temp = ne - nfd;
|
||||
@ -927,7 +943,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
/* At the end of a line the characters do not have to
|
||||
be "inserted". They can just be placed on the screen. */
|
||||
/* However, this screws up the rest of this block, which
|
||||
assumes you've done the insert because you can. */
|
||||
assumes you've done the insert because you can. */
|
||||
_rl_output_some_chars (nfd, lendiff);
|
||||
_rl_last_c_pos += lendiff;
|
||||
}
|
||||
@ -987,10 +1003,13 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
_rl_last_c_pos += temp;
|
||||
}
|
||||
lendiff = (oe - old) - (ne - new);
|
||||
if (_rl_term_autowrap && current_line < inv_botlin)
|
||||
space_to_eol (lendiff);
|
||||
else
|
||||
_rl_clear_to_eol (lendiff);
|
||||
if (lendiff)
|
||||
{
|
||||
if (_rl_term_autowrap && current_line < inv_botlin)
|
||||
space_to_eol (lendiff);
|
||||
else
|
||||
_rl_clear_to_eol (lendiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1019,7 +1038,7 @@ rl_forced_update_display ()
|
||||
register char *temp = visible_line;
|
||||
|
||||
while (*temp)
|
||||
*temp++ = '\0';
|
||||
*temp++ = '\0';
|
||||
}
|
||||
rl_on_new_line ();
|
||||
forced_display++;
|
||||
@ -1080,7 +1099,7 @@ _rl_move_cursor_relative (new, data)
|
||||
putc (data[i], rl_outstream);
|
||||
#endif /* HACK_TERMCAP_MOTION */
|
||||
}
|
||||
else if (_rl_last_c_pos != new)
|
||||
else if (_rl_last_c_pos > new)
|
||||
_rl_backspace (_rl_last_c_pos - new);
|
||||
_rl_last_c_pos = new;
|
||||
}
|
||||
@ -1245,7 +1264,7 @@ static int saved_last_invisible;
|
||||
static int saved_visible_length;
|
||||
|
||||
void
|
||||
_rl_save_prompt ()
|
||||
rl_save_prompt ()
|
||||
{
|
||||
saved_local_prompt = local_prompt;
|
||||
saved_local_prefix = local_prompt_prefix;
|
||||
@ -1257,7 +1276,7 @@ _rl_save_prompt ()
|
||||
}
|
||||
|
||||
void
|
||||
_rl_restore_prompt ()
|
||||
rl_restore_prompt ()
|
||||
{
|
||||
if (local_prompt)
|
||||
free (local_prompt);
|
||||
@ -1277,14 +1296,14 @@ _rl_make_prompt_for_search (pchar)
|
||||
int len;
|
||||
char *pmt;
|
||||
|
||||
_rl_save_prompt ();
|
||||
rl_save_prompt ();
|
||||
|
||||
if (saved_local_prompt == 0)
|
||||
{
|
||||
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
|
||||
pmt = xmalloc (len + 2);
|
||||
if (len)
|
||||
strcpy (pmt, rl_prompt);
|
||||
strcpy (pmt, rl_prompt);
|
||||
pmt[len] = pchar;
|
||||
pmt[len+1] = '\0';
|
||||
}
|
||||
@ -1293,7 +1312,7 @@ _rl_make_prompt_for_search (pchar)
|
||||
len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
|
||||
pmt = xmalloc (len + 2);
|
||||
if (len)
|
||||
strcpy (pmt, saved_local_prompt);
|
||||
strcpy (pmt, saved_local_prompt);
|
||||
pmt[len] = pchar;
|
||||
pmt[len+1] = '\0';
|
||||
local_prompt = savestring (pmt);
|
||||
@ -1540,6 +1559,15 @@ _rl_clean_up_for_exit ()
|
||||
_rl_move_vert (_rl_vis_botlin);
|
||||
_rl_vis_botlin = 0;
|
||||
fflush (rl_outstream);
|
||||
rl_restart_output ();
|
||||
rl_restart_output (1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_rl_erase_entire_line ()
|
||||
{
|
||||
cr ();
|
||||
_rl_clear_to_eol (0);
|
||||
cr ();
|
||||
fflush (rl_outstream);
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@ins.CWRU.Edu
|
||||
.\"
|
||||
.\" Last Change: Thu Feb 19 10:26:47 EST 1998
|
||||
.\" Last Change: Thu Dec 31 10:16:30 EST 1998
|
||||
.\"
|
||||
.TH READLINE 3 "1998 Feb 19" GNU
|
||||
.TH READLINE 3 "1998 Dec 31" GNU
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@ -22,6 +22,7 @@ readline \- get a line from a user with editing
|
||||
.LP
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
.ft
|
||||
@ -380,6 +381,19 @@ When set to \fBOn\fP, makes readline use a single line for display,
|
||||
scrolling the input horizontally on a single screen line when it
|
||||
becomes longer than the screen width rather than wrapping to a new line.
|
||||
.TP
|
||||
.B input\-meta (Off)
|
||||
If set to \fBOn\fP, readline will enable eight-bit input (that is,
|
||||
it will not strip the high bit from the characters it reads),
|
||||
regardless of what the terminal claims it can support. The name
|
||||
.B meta\-flag
|
||||
is a synonym for this variable.
|
||||
.TP
|
||||
.B isearch\-terminators (``C\-[C\-J'')
|
||||
The string of characters that should terminate an incremental
|
||||
search without subsequently executing the character as a command.
|
||||
If this variable has not been given a value, the characters
|
||||
\fIESC\fP and \fIC\-J\fP will terminate an incremental search.
|
||||
.TP
|
||||
.B keymap (emacs)
|
||||
Set the current readline keymap. The set of legal keymap names is
|
||||
\fIemacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move,
|
||||
@ -400,11 +414,6 @@ appended.
|
||||
If set to \fBOn\fP, history lines that have been modified are displayed
|
||||
with a preceding asterisk (\fB*\fP).
|
||||
.TP
|
||||
.B meta\-flag (Off)
|
||||
If set to \fBOn\fP, readline will enable eight-bit input (that is,
|
||||
it will not strip the high bit from the characters it reads),
|
||||
regardless of what the terminal claims it can support.
|
||||
.TP
|
||||
.B output\-meta (Off)
|
||||
If set to \fBOn\fP, readline will display characters with the
|
||||
eighth bit set directly rather than as a meta-prefixed escape
|
||||
@ -509,8 +518,10 @@ As each character of the search string is typed, readline displays
|
||||
the next entry from the history matching the string typed so far.
|
||||
An incremental search requires only as many characters as needed to
|
||||
find the desired history entry.
|
||||
The Escape character is used to terminate an incremental search.
|
||||
Control-J will also terminate the search.
|
||||
The characters present in the value of the \fIisearch-terminators\fP
|
||||
variable are used to terminate an incremental search.
|
||||
If that variable has not been assigned a value the Escape and
|
||||
Control-J characters will terminate an incremental search.
|
||||
Control-G will abort an incremental search and restore the original
|
||||
line.
|
||||
When the search is terminated, the history entry containing the
|
||||
@ -647,6 +658,11 @@ the last character typed was not bound to \fBBdelete\-char\fP, then return
|
||||
Delete the character behind the cursor. When given a numeric argument,
|
||||
save the deleted text on the kill ring.
|
||||
.TP
|
||||
.B forward\-backward\-delete\-char
|
||||
Delete the character under the cursor, unless the cursor is at the
|
||||
end of the line, in which case the character behind the cursor is
|
||||
deleted. By default, this is not bound to a key.
|
||||
.TP
|
||||
.B quoted\-insert (C\-q, C\-v)
|
||||
Add the next character that you type to the line verbatim. This is
|
||||
how to insert characters like \fBC\-q\fP, for example.
|
||||
@ -798,6 +814,13 @@ of matches; a negative argument may be used to move backward
|
||||
through the list.
|
||||
This command is intended to be bound to \fBTAB\fP, but is unbound
|
||||
by default.
|
||||
.TP
|
||||
.B delete\-char\-or\-list
|
||||
Deletes the character under the cursor if not at the beginning or
|
||||
end of the line (like \fBdelete-char\fP).
|
||||
If at the end of the line, behaves identically to
|
||||
\fBpossible-completions\fP.
|
||||
This command is unbound by default.
|
||||
.PD
|
||||
.SS Keyboard Macros
|
||||
.PP
|
||||
@ -847,7 +870,7 @@ Undo all changes made to this line. This is like executing the
|
||||
.B undo
|
||||
command enough times to return the line to its initial state.
|
||||
.TP
|
||||
.B tilde\-expand (M\-~)
|
||||
.B tilde\-expand (M\-&)
|
||||
Perform tilde expansion on the current word.
|
||||
.TP
|
||||
.B set\-mark (C\-@, M-<space>)
|
||||
|
@ -6,9 +6,9 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@ins.CWRU.Edu
|
||||
.\"
|
||||
.\" Last Change: Thu Feb 19 10:26:47 EST 1998
|
||||
.\" Last Change: Thu Dec 31 10:16:30 EST 1998
|
||||
.\"
|
||||
.TH READLINE 3 "1998 Feb 19" GNU
|
||||
.TH READLINE 3 "1998 Dec 31" GNU
|
||||
.\"
|
||||
.\" File Name macro. This used to be `.PN', for Path Name,
|
||||
.\" but Sun doesn't seem to like that very much.
|
||||
@ -22,6 +22,7 @@ readline \- get a line from a user with editing
|
||||
.LP
|
||||
.nf
|
||||
.ft B
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
.ft
|
||||
@ -380,6 +381,19 @@ When set to \fBOn\fP, makes readline use a single line for display,
|
||||
scrolling the input horizontally on a single screen line when it
|
||||
becomes longer than the screen width rather than wrapping to a new line.
|
||||
.TP
|
||||
.B input\-meta (Off)
|
||||
If set to \fBOn\fP, readline will enable eight-bit input (that is,
|
||||
it will not strip the high bit from the characters it reads),
|
||||
regardless of what the terminal claims it can support. The name
|
||||
.B meta\-flag
|
||||
is a synonym for this variable.
|
||||
.TP
|
||||
.B isearch\-terminators (``C\-[C\-J'')
|
||||
The string of characters that should terminate an incremental
|
||||
search without subsequently executing the character as a command.
|
||||
If this variable has not been given a value, the characters
|
||||
\fIESC\fP and \fIC\-J\fP will terminate an incremental search.
|
||||
.TP
|
||||
.B keymap (emacs)
|
||||
Set the current readline keymap. The set of legal keymap names is
|
||||
\fIemacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move,
|
||||
@ -400,11 +414,6 @@ appended.
|
||||
If set to \fBOn\fP, history lines that have been modified are displayed
|
||||
with a preceding asterisk (\fB*\fP).
|
||||
.TP
|
||||
.B meta\-flag (Off)
|
||||
If set to \fBOn\fP, readline will enable eight-bit input (that is,
|
||||
it will not strip the high bit from the characters it reads),
|
||||
regardless of what the terminal claims it can support.
|
||||
.TP
|
||||
.B output\-meta (Off)
|
||||
If set to \fBOn\fP, readline will display characters with the
|
||||
eighth bit set directly rather than as a meta-prefixed escape
|
||||
@ -509,8 +518,10 @@ As each character of the search string is typed, readline displays
|
||||
the next entry from the history matching the string typed so far.
|
||||
An incremental search requires only as many characters as needed to
|
||||
find the desired history entry.
|
||||
The Escape character is used to terminate an incremental search.
|
||||
Control-J will also terminate the search.
|
||||
The characters present in the value of the \fIisearch-terminators\fP
|
||||
variable are used to terminate an incremental search.
|
||||
If that variable has not been assigned a value the Escape and
|
||||
Control-J characters will terminate an incremental search.
|
||||
Control-G will abort an incremental search and restore the original
|
||||
line.
|
||||
When the search is terminated, the history entry containing the
|
||||
@ -647,6 +658,11 @@ the last character typed was not bound to \fBBdelete\-char\fP, then return
|
||||
Delete the character behind the cursor. When given a numeric argument,
|
||||
save the deleted text on the kill ring.
|
||||
.TP
|
||||
.B forward\-backward\-delete\-char
|
||||
Delete the character under the cursor, unless the cursor is at the
|
||||
end of the line, in which case the character behind the cursor is
|
||||
deleted. By default, this is not bound to a key.
|
||||
.TP
|
||||
.B quoted\-insert (C\-q, C\-v)
|
||||
Add the next character that you type to the line verbatim. This is
|
||||
how to insert characters like \fBC\-q\fP, for example.
|
||||
@ -798,6 +814,13 @@ of matches; a negative argument may be used to move backward
|
||||
through the list.
|
||||
This command is intended to be bound to \fBTAB\fP, but is unbound
|
||||
by default.
|
||||
.TP
|
||||
.B delete\-char\-or\-list
|
||||
Deletes the character under the cursor if not at the beginning or
|
||||
end of the line (like \fBdelete-char\fP).
|
||||
If at the end of the line, behaves identically to
|
||||
\fBpossible-completions\fP.
|
||||
This command is unbound by default.
|
||||
.PD
|
||||
.SS Keyboard Macros
|
||||
.PP
|
||||
@ -847,7 +870,7 @@ Undo all changes made to this line. This is like executing the
|
||||
.B undo
|
||||
command enough times to return the line to its initial state.
|
||||
.TP
|
||||
.B tilde\-expand (M\-~)
|
||||
.B tilde\-expand (M\-&)
|
||||
Perform tilde expansion on the current word.
|
||||
.TP
|
||||
.B set\-mark (C\-@, M-<space>)
|
||||
|
@ -23,10 +23,16 @@
|
||||
#if !defined (_READLINE_H_)
|
||||
#define _READLINE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined (READLINE_LIBRARY)
|
||||
# include "rlstdc.h"
|
||||
# include "keymaps.h"
|
||||
# include "tilde.h"
|
||||
#else
|
||||
# include <readline/rlstdc.h>
|
||||
# include <readline/keymaps.h>
|
||||
# include <readline/tilde.h>
|
||||
#endif
|
||||
@ -60,78 +66,191 @@ typedef struct _funmap {
|
||||
|
||||
extern FUNMAP **funmap;
|
||||
|
||||
/* Functions available to bind to key sequences. */
|
||||
extern int
|
||||
rl_tilde_expand (), rl_set_mark (), rl_exchange_point_and_mark (),
|
||||
rl_beg_of_line (), rl_backward (), rl_delete (), rl_end_of_line (),
|
||||
rl_forward (), ding (), rl_newline (), rl_kill_line (),
|
||||
rl_copy_region_to_kill (), rl_kill_region (), rl_char_search (),
|
||||
rl_clear_screen (), rl_get_next_history (), rl_get_previous_history (),
|
||||
rl_quoted_insert (), rl_reverse_search_history (), rl_transpose_chars (),
|
||||
rl_unix_line_discard (), rl_unix_word_rubout (),
|
||||
rl_yank (), rl_rubout (), rl_backward_word (), rl_kill_word (),
|
||||
rl_forward_word (), rl_tab_insert (), rl_yank_pop (), rl_yank_nth_arg (),
|
||||
rl_backward_kill_word (), rl_backward_kill_line (), rl_transpose_words (),
|
||||
rl_complete (), rl_possible_completions (), rl_insert_completions (),
|
||||
rl_menu_complete (),
|
||||
rl_do_lowercase_version (), rl_kill_full_line (),
|
||||
rl_digit_argument (), rl_universal_argument (), rl_abort (),
|
||||
rl_undo_command (), rl_revert_line (), rl_beginning_of_history (),
|
||||
rl_end_of_history (), rl_forward_search_history (), rl_insert (),
|
||||
rl_upcase_word (), rl_downcase_word (), rl_capitalize_word (),
|
||||
rl_restart_output (), rl_re_read_init_file (),
|
||||
rl_dump_functions (), rl_dump_variables (), rl_dump_macros (),
|
||||
rl_delete_horizontal_space (), rl_history_search_forward (),
|
||||
rl_history_search_backward (), rl_tty_status (), rl_yank_last_arg (),
|
||||
rl_insert_comment (), rl_backward_char_search (),
|
||||
rl_copy_forward_word (), rl_copy_backward_word ();
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Functions available to bind to key sequences */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Not available unless readline is compiled -DPAREN_MATCHING. */
|
||||
extern int rl_insert_close ();
|
||||
/* Bindable commands for numeric arguments. */
|
||||
extern int rl_digit_argument __P((int, int));
|
||||
extern int rl_universal_argument __P((int, int));
|
||||
|
||||
/* Not available unless READLINE_CALLBACKS is defined. */
|
||||
extern void rl_callback_handler_install ();
|
||||
extern void rl_callback_read_char ();
|
||||
extern void rl_callback_handler_remove ();
|
||||
/* Bindable commands for moving the cursor. */
|
||||
extern int rl_forward __P((int, int));
|
||||
extern int rl_backward __P((int, int));
|
||||
extern int rl_beg_of_line __P((int, int));
|
||||
extern int rl_end_of_line __P((int, int));
|
||||
extern int rl_forward_word __P((int, int));
|
||||
extern int rl_backward_word __P((int, int));
|
||||
extern int rl_refresh_line __P((int, int));
|
||||
extern int rl_clear_screen __P((int, int));
|
||||
extern int rl_arrow_keys __P((int, int));
|
||||
|
||||
/* Bindable commands for inserting and deleting text. */
|
||||
extern int rl_insert __P((int, int));
|
||||
extern int rl_quoted_insert __P((int, int));
|
||||
extern int rl_tab_insert __P((int, int));
|
||||
extern int rl_newline __P((int, int));
|
||||
extern int rl_do_lowercase_version __P((int, int));
|
||||
extern int rl_rubout __P((int, int));
|
||||
extern int rl_delete __P((int, int));
|
||||
extern int rl_rubout_or_delete __P((int, int));
|
||||
extern int rl_delete_horizontal_space __P((int, int));
|
||||
extern int rl_delete_or_show_completions __P((int, int));
|
||||
extern int rl_insert_comment __P((int, int));
|
||||
|
||||
/* Bindable commands for changing case. */
|
||||
extern int rl_upcase_word __P((int, int));
|
||||
extern int rl_downcase_word __P((int, int));
|
||||
extern int rl_capitalize_word __P((int, int));
|
||||
|
||||
/* Bindable commands for transposing characters and words. */
|
||||
extern int rl_transpose_words __P((int, int));
|
||||
extern int rl_transpose_chars __P((int, int));
|
||||
|
||||
/* Bindable commands for searching within a line. */
|
||||
extern int rl_char_search __P((int, int));
|
||||
extern int rl_backward_char_search __P((int, int));
|
||||
|
||||
/* Bindable commands for readline's interface to the command history. */
|
||||
extern int rl_beginning_of_history __P((int, int));
|
||||
extern int rl_end_of_history __P((int, int));
|
||||
extern int rl_get_next_history __P((int, int));
|
||||
extern int rl_get_previous_history __P((int, int));
|
||||
|
||||
/* Bindable commands for managing the mark and region. */
|
||||
extern int rl_set_mark __P((int, int));
|
||||
extern int rl_exchange_point_and_mark __P((int, int));
|
||||
|
||||
/* Bindable commands to set the editing mode (emacs or vi). */
|
||||
extern int rl_vi_editing_mode __P((int, int));
|
||||
extern int rl_emacs_editing_mode __P((int, int));
|
||||
|
||||
/* Bindable commands for managing key bindings. */
|
||||
extern int rl_re_read_init_file __P((int, int));
|
||||
extern int rl_dump_functions __P((int, int));
|
||||
extern int rl_dump_macros __P((int, int));
|
||||
extern int rl_dump_variables __P((int, int));
|
||||
|
||||
/* Bindable commands for word completion. */
|
||||
extern int rl_complete __P((int, int));
|
||||
extern int rl_possible_completions __P((int, int));
|
||||
extern int rl_insert_completions __P((int, int));
|
||||
extern int rl_menu_complete __P((int, int));
|
||||
|
||||
/* Bindable commands for killing and yanking text, and managing the kill ring. */
|
||||
extern int rl_kill_word __P((int, int));
|
||||
extern int rl_backward_kill_word __P((int, int));
|
||||
extern int rl_kill_line __P((int, int));
|
||||
extern int rl_backward_kill_line __P((int, int));
|
||||
extern int rl_kill_full_line __P((int, int));
|
||||
extern int rl_unix_word_rubout __P((int, int));
|
||||
extern int rl_unix_line_discard __P((int, int));
|
||||
extern int rl_copy_region_to_kill __P((int, int));
|
||||
extern int rl_kill_region __P((int, int));
|
||||
extern int rl_copy_forward_word __P((int, int));
|
||||
extern int rl_copy_backward_word __P((int, int));
|
||||
extern int rl_yank __P((int, int));
|
||||
extern int rl_yank_pop __P((int, int));
|
||||
extern int rl_yank_nth_arg __P((int, int));
|
||||
extern int rl_yank_last_arg __P((int, int));
|
||||
/* Not available unless __CYGWIN32__ is defined. */
|
||||
#ifdef __CYGWIN32__
|
||||
extern int rl_paste_from_clipboard ();
|
||||
extern int rl_paste_from_clipboard __P((int, int));
|
||||
#endif
|
||||
|
||||
/* These are *both* defined even when VI_MODE is not. */
|
||||
extern int rl_vi_editing_mode (), rl_emacs_editing_mode ();
|
||||
/* Bindable commands for incremental searching. */
|
||||
extern int rl_reverse_search_history __P((int, int));
|
||||
extern int rl_forward_search_history __P((int, int));
|
||||
|
||||
/* Non incremental history searching. */
|
||||
extern int rl_noninc_forward_search ();
|
||||
extern int rl_noninc_reverse_search ();
|
||||
extern int rl_noninc_forward_search_again ();
|
||||
extern int rl_noninc_reverse_search_again ();
|
||||
/* Bindable keyboard macro commands. */
|
||||
extern int rl_start_kbd_macro __P((int, int));
|
||||
extern int rl_end_kbd_macro __P((int, int));
|
||||
extern int rl_call_last_kbd_macro __P((int, int));
|
||||
|
||||
/* Bindable undo commands. */
|
||||
extern int rl_revert_line __P((int, int));
|
||||
extern int rl_undo_command __P((int, int));
|
||||
|
||||
/* Bindable tilde expansion commands. */
|
||||
extern int rl_tilde_expand __P((int, int));
|
||||
|
||||
/* Bindable terminal control commands. */
|
||||
extern int rl_restart_output __P((int, int));
|
||||
extern int rl_stop_output __P((int, int));
|
||||
|
||||
/* Miscellaneous bindable commands. */
|
||||
extern int rl_abort __P((int, int));
|
||||
extern int rl_tty_status __P((int, int));
|
||||
|
||||
/* Bindable commands for incremental and non-incremental history searching. */
|
||||
extern int rl_history_search_forward __P((int, int));
|
||||
extern int rl_history_search_backward __P((int, int));
|
||||
extern int rl_noninc_forward_search __P((int, int));
|
||||
extern int rl_noninc_reverse_search __P((int, int));
|
||||
extern int rl_noninc_forward_search_again __P((int, int));
|
||||
extern int rl_noninc_reverse_search_again __P((int, int));
|
||||
|
||||
/* Not available unless readline is compiled -DPAREN_MATCHING. */
|
||||
extern int rl_insert_close __P((int, int));
|
||||
|
||||
/* Not available unless READLINE_CALLBACKS is defined. */
|
||||
extern void rl_callback_handler_install __P((char *, VFunction *));
|
||||
extern void rl_callback_read_char __P((void));
|
||||
extern void rl_callback_handler_remove __P((void));
|
||||
|
||||
/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
|
||||
extern int rl_vi_check ();
|
||||
extern int
|
||||
rl_vi_undo (), rl_vi_redo (), rl_vi_tilde_expand (),
|
||||
rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (),
|
||||
rl_vi_prev_word (), rl_vi_next_word (), rl_vi_char_search (),
|
||||
rl_vi_eof_maybe (), rl_vi_append_mode (), rl_vi_put (),
|
||||
rl_vi_append_eol (), rl_vi_insert_beg (), rl_vi_delete (),
|
||||
rl_vi_first_print (), rl_vi_fword (), rl_vi_fWord (), rl_vi_bword (),
|
||||
rl_vi_bWord (), rl_vi_eword (), rl_vi_eWord (), rl_vi_end_word (),
|
||||
rl_vi_change_case (), rl_vi_match (), rl_vi_bracktype (),
|
||||
rl_vi_change_char (), rl_vi_yank_arg (), rl_vi_search (),
|
||||
rl_vi_search_again (), rl_vi_subst (), rl_vi_overstrike (),
|
||||
rl_vi_overstrike_delete (), rl_vi_replace(), rl_vi_column (),
|
||||
rl_vi_delete_to (), rl_vi_change_to (), rl_vi_yank_to (),
|
||||
rl_vi_complete (), rl_vi_fetch_history (), rl_vi_set_mark (),
|
||||
rl_vi_goto_mark (), rl_vi_back_to_indent ();
|
||||
/* VI-mode bindable commands. */
|
||||
extern int rl_vi_redo __P((int, int));
|
||||
extern int rl_vi_undo __P((int, int));
|
||||
extern int rl_vi_yank_arg __P((int, int));
|
||||
extern int rl_vi_fetch_history __P((int, int));
|
||||
extern int rl_vi_search_again __P((int, int));
|
||||
extern int rl_vi_search __P((int, int));
|
||||
extern int rl_vi_complete __P((int, int));
|
||||
extern int rl_vi_tilde_expand __P((int, int));
|
||||
extern int rl_vi_prev_word __P((int, int));
|
||||
extern int rl_vi_next_word __P((int, int));
|
||||
extern int rl_vi_end_word __P((int, int));
|
||||
extern int rl_vi_insert_beg __P((int, int));
|
||||
extern int rl_vi_append_mode __P((int, int));
|
||||
extern int rl_vi_append_eol __P((int, int));
|
||||
extern int rl_vi_eof_maybe __P((int, int));
|
||||
extern int rl_vi_insertion_mode __P((int, int));
|
||||
extern int rl_vi_movement_mode __P((int, int));
|
||||
extern int rl_vi_arg_digit __P((int, int));
|
||||
extern int rl_vi_change_case __P((int, int));
|
||||
extern int rl_vi_put __P((int, int));
|
||||
extern int rl_vi_column __P((int, int));
|
||||
extern int rl_vi_delete_to __P((int, int));
|
||||
extern int rl_vi_change_to __P((int, int));
|
||||
extern int rl_vi_yank_to __P((int, int));
|
||||
extern int rl_vi_delete __P((int, int));
|
||||
extern int rl_vi_back_to_indent __P((int, int));
|
||||
extern int rl_vi_first_print __P((int, int));
|
||||
extern int rl_vi_char_search __P((int, int));
|
||||
extern int rl_vi_match __P((int, int));
|
||||
extern int rl_vi_change_char __P((int, int));
|
||||
extern int rl_vi_subst __P((int, int));
|
||||
extern int rl_vi_overstrike __P((int, int));
|
||||
extern int rl_vi_overstrike_delete __P((int, int));
|
||||
extern int rl_vi_replace __P((int, int));
|
||||
extern int rl_vi_set_mark __P((int, int));
|
||||
extern int rl_vi_goto_mark __P((int, int));
|
||||
|
||||
/* Keyboard macro commands. */
|
||||
extern int rl_start_kbd_macro (), rl_end_kbd_macro ();
|
||||
extern int rl_call_last_kbd_macro ();
|
||||
extern void rl_push_macro_input ();
|
||||
/* VI-mode utility functions. */
|
||||
extern int rl_vi_check __P((void));
|
||||
extern int rl_vi_domove __P((int, int *));
|
||||
extern int rl_vi_bracktype __P((int));
|
||||
|
||||
extern int rl_arrow_keys(), rl_refresh_line ();
|
||||
/* VI-mode pseudo-bindable commands, used as utility functions. */
|
||||
extern int rl_vi_fWord __P((int, int));
|
||||
extern int rl_vi_bWord __P((int, int));
|
||||
extern int rl_vi_eWord __P((int, int));
|
||||
extern int rl_vi_fword __P((int, int));
|
||||
extern int rl_vi_bword __P((int, int));
|
||||
extern int rl_vi_eword __P((int, int));
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
@ -141,51 +260,80 @@ extern int rl_arrow_keys(), rl_refresh_line ();
|
||||
|
||||
/* Readline functions. */
|
||||
/* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */
|
||||
extern char *readline ();
|
||||
extern char *readline __P((char *));
|
||||
|
||||
/* These functions are from bind.c. */
|
||||
/* rl_add_defun (char *name, Function *function, int key)
|
||||
Add NAME to the list of named functions. Make FUNCTION
|
||||
be the function that gets called.
|
||||
If KEY is not -1, then bind it. */
|
||||
extern int rl_add_defun ();
|
||||
extern int rl_initialize __P((void));
|
||||
|
||||
extern char *rl_get_keymap_name ();
|
||||
extern int rl_discard_argument __P((void));
|
||||
|
||||
/* Utility functions to bind keys to readline commands. */
|
||||
extern int rl_add_defun __P((char *, Function *, int));
|
||||
extern int rl_bind_key __P((int, Function *));
|
||||
extern int rl_bind_key_in_map __P((int, Function *, Keymap));
|
||||
extern int rl_unbind_key __P((int));
|
||||
extern int rl_unbind_key_in_map __P((int, Keymap));
|
||||
extern int rl_unbind_function_in_map __P((Function *, Keymap));
|
||||
extern int rl_unbind_command_in_map __P((char *, Keymap));
|
||||
extern int rl_set_key __P((char *, Function *, Keymap));
|
||||
extern int rl_generic_bind __P((int, char *, char *, Keymap));
|
||||
extern int rl_variable_bind __P((char *, char *));
|
||||
|
||||
extern int rl_bind_key (), rl_bind_key_in_map ();
|
||||
extern int rl_unbind_key (), rl_unbind_key_in_map ();
|
||||
extern int rl_unbind_function_in_map (), rl_unbind_command_in_map ();
|
||||
extern int rl_set_key ();
|
||||
extern int rl_generic_bind ();
|
||||
extern int rl_parse_and_bind ();
|
||||
/* Backwards compatibility, use rl_generic_bind instead. */
|
||||
extern int rl_macro_bind (), rl_variable_bind ();
|
||||
|
||||
extern int rl_read_init_file ();
|
||||
|
||||
extern Function *rl_named_function (), *rl_function_of_keyseq ();
|
||||
extern char **rl_invoking_keyseqs (), **rl_invoking_keyseqs_in_map ();
|
||||
extern void rl_function_dumper ();
|
||||
extern void rl_variable_dumper ();
|
||||
extern void rl_macro_dumper ();
|
||||
extern void rl_list_funmap_names ();
|
||||
extern int rl_macro_bind __P((char *, char *, Keymap));
|
||||
|
||||
/* Undocumented in the texinfo manual; not really useful to programs. */
|
||||
extern int rl_translate_keyseq ();
|
||||
extern void rl_initialize_funmap ();
|
||||
extern int rl_translate_keyseq __P((char *, char *, int *));
|
||||
extern char *rl_untranslate_keyseq __P((int));
|
||||
|
||||
/* Functions for undoing. */
|
||||
extern int rl_begin_undo_group (), rl_end_undo_group ();
|
||||
extern void rl_add_undo (), free_undo_list ();
|
||||
extern int rl_do_undo ();
|
||||
extern int rl_modifying ();
|
||||
extern Function *rl_named_function __P((char *));
|
||||
extern Function *rl_function_of_keyseq __P((char *, Keymap, int *));
|
||||
|
||||
extern void rl_list_funmap_names __P((void));
|
||||
extern char **rl_invoking_keyseqs_in_map __P((Function *, Keymap));
|
||||
extern char **rl_invoking_keyseqs __P((Function *));
|
||||
|
||||
extern void rl_function_dumper __P((int));
|
||||
extern void rl_macro_dumper __P((int));
|
||||
extern void rl_variable_dumper __P((int));
|
||||
|
||||
extern int rl_read_init_file __P((char *));
|
||||
extern int rl_parse_and_bind __P((char *));
|
||||
|
||||
/* Functions for manipulating keymaps. */
|
||||
extern Keymap rl_make_bare_keymap __P((void));
|
||||
extern Keymap rl_copy_keymap __P((Keymap));
|
||||
extern Keymap rl_make_keymap __P((void));
|
||||
extern void rl_discard_keymap __P((Keymap));
|
||||
|
||||
extern Keymap rl_get_keymap_by_name __P((char *));
|
||||
extern char *rl_get_keymap_name __P((Keymap));
|
||||
extern void rl_set_keymap __P((Keymap));
|
||||
extern Keymap rl_get_keymap __P((void));
|
||||
extern void rl_set_keymap_from_edit_mode __P((void));
|
||||
extern char *rl_get_keymap_name_from_edit_mode __P((void));
|
||||
|
||||
/* Functions for manipulating the funmap, which maps command names to functions. */
|
||||
extern int rl_add_funmap_entry __P((char *, Function *));
|
||||
extern void rl_initialize_funmap __P((void));
|
||||
extern char **rl_funmap_names __P((void));
|
||||
|
||||
/* Utility functions for managing keyboard macros. */
|
||||
extern void rl_push_macro_input __P((char *));
|
||||
|
||||
/* Functions for undoing, from undo.c */
|
||||
extern void rl_add_undo __P((enum undo_code, int, int, char *));
|
||||
extern void free_undo_list __P((void));
|
||||
extern int rl_do_undo __P((void));
|
||||
extern int rl_begin_undo_group __P((void));
|
||||
extern int rl_end_undo_group __P((void));
|
||||
extern int rl_modifying __P((int, int));
|
||||
|
||||
/* Functions for redisplay. */
|
||||
extern void rl_redisplay ();
|
||||
extern int rl_forced_update_display ();
|
||||
extern int rl_clear_message ();
|
||||
extern int rl_reset_line_state ();
|
||||
extern int rl_on_new_line ();
|
||||
extern void rl_redisplay __P((void));
|
||||
extern int rl_on_new_line __P((void));
|
||||
extern int rl_forced_update_display __P((void));
|
||||
extern int rl_clear_message __P((void));
|
||||
extern int rl_reset_line_state __P((void));
|
||||
|
||||
#if defined (__STDC__) && defined (USE_VARARGS) && defined (PREFER_STDARG)
|
||||
extern int rl_message (const char *, ...);
|
||||
@ -194,36 +342,59 @@ extern int rl_message ();
|
||||
#endif
|
||||
|
||||
/* Undocumented in texinfo manual. */
|
||||
extern int rl_character_len ();
|
||||
extern int rl_show_char ();
|
||||
extern int crlf ();
|
||||
extern int rl_show_char __P((int));
|
||||
extern int rl_character_len __P((int, int));
|
||||
extern int crlf __P((void));
|
||||
|
||||
/* Save and restore internal prompt redisplay information. */
|
||||
extern void rl_save_prompt __P((void));
|
||||
extern void rl_restore_prompt __P((void));
|
||||
|
||||
/* Modifying text. */
|
||||
extern int rl_insert_text (), rl_delete_text ();
|
||||
extern int rl_kill_text ();
|
||||
extern char *rl_copy_text ();
|
||||
extern int rl_insert_text __P((char *));
|
||||
extern int rl_delete_text __P((int, int));
|
||||
extern int rl_kill_text __P((int, int));
|
||||
extern char *rl_copy_text __P((int, int));
|
||||
|
||||
/* `Public' utility functions. */
|
||||
extern int rl_reset_terminal ();
|
||||
extern int rl_stuff_char ();
|
||||
extern int rl_read_key (), rl_getc ();
|
||||
/* Terminal and tty mode management. */
|
||||
extern void rl_prep_terminal __P((int));
|
||||
extern void rl_deprep_terminal __P((void));
|
||||
extern void rltty_set_default_bindings __P((Keymap));
|
||||
|
||||
extern int rl_initialize ();
|
||||
extern int rl_reset_terminal __P((char *));
|
||||
extern void rl_resize_terminal __P((void));
|
||||
|
||||
/* `Public' utility functions . */
|
||||
extern void rl_extend_line_buffer __P((int));
|
||||
extern int ding __P((void));
|
||||
|
||||
/* Functions for character input. */
|
||||
extern int rl_stuff_char __P((int));
|
||||
extern int rl_execute_next __P((int));
|
||||
extern int rl_read_key __P((void));
|
||||
extern int rl_getc __P((FILE *));
|
||||
|
||||
/* Readline signal handling, from signals.c */
|
||||
extern int rl_set_signals __P((void));
|
||||
extern int rl_clear_signals __P((void));
|
||||
extern void rl_cleanup_after_signal __P((void));
|
||||
extern void rl_reset_after_signal __P((void));
|
||||
extern void rl_free_line_state __P((void));
|
||||
|
||||
/* Undocumented. */
|
||||
extern int rl_expand_prompt ();
|
||||
extern int rl_set_signals (), rl_clear_signals ();
|
||||
extern int maybe_save_line (), maybe_unsave_line (), maybe_replace_line ();
|
||||
extern int rl_expand_prompt __P((char *));
|
||||
|
||||
extern int maybe_save_line __P((void));
|
||||
extern int maybe_unsave_line __P((void));
|
||||
extern int maybe_replace_line __P((void));
|
||||
|
||||
/* Completion functions. */
|
||||
/* These functions are from complete.c. */
|
||||
extern int rl_complete_internal ();
|
||||
extern int rl_complete_internal __P((int));
|
||||
extern void rl_display_match_list __P((char **, int, int));
|
||||
|
||||
/* Return an array of strings which are the result of repeatadly calling
|
||||
FUNC with TEXT. */
|
||||
extern char **completion_matches ();
|
||||
extern char *username_completion_function ();
|
||||
extern char *filename_completion_function ();
|
||||
extern char **completion_matches __P((char *, CPFunction *));
|
||||
extern char *username_completion_function __P((char *, int));
|
||||
extern char *filename_completion_function __P((char *, int));
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
@ -248,10 +419,14 @@ extern char *rl_line_buffer;
|
||||
/* The location of point, and end. */
|
||||
extern int rl_point, rl_end;
|
||||
|
||||
/* The mark, or saved cursor position. */
|
||||
extern int rl_mark;
|
||||
|
||||
/* Flag to indicate that readline has finished with the current input
|
||||
line and should return it. */
|
||||
extern int rl_done;
|
||||
|
||||
/* If set to a character value, that will be the next keystroke read. */
|
||||
extern int rl_pending_input;
|
||||
|
||||
/* Non-zero if we called this function from _rl_dispatch(). It's present
|
||||
@ -269,6 +444,11 @@ extern FILE *rl_instream, *rl_outstream;
|
||||
before readline_internal () prints the first prompt. */
|
||||
extern Function *rl_startup_hook;
|
||||
|
||||
/* If non-zero, this is the address of a function to call just before
|
||||
readline_internal_setup () returns and readline_internal starts
|
||||
reading input characters. */
|
||||
extern Function *rl_pre_input_hook;
|
||||
|
||||
/* The address of a function to call periodically while Readline is
|
||||
awaiting character input, or NULL, for no event handling. */
|
||||
extern Function *rl_event_hook;
|
||||
@ -282,6 +462,24 @@ extern VFunction *rl_deprep_term_function;
|
||||
extern Keymap rl_executing_keymap;
|
||||
extern Keymap rl_binding_keymap;
|
||||
|
||||
/* Display variables. */
|
||||
/* If non-zero, readline will erase the entire line, including any prompt,
|
||||
if the only thing typed on an otherwise-blank line is something bound to
|
||||
rl_newline. */
|
||||
extern int rl_erase_empty_line;
|
||||
|
||||
/* Variables to control readline signal handling. */
|
||||
/* If non-zero, readline will install its own signal handlers for
|
||||
SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
|
||||
extern int rl_catch_signals;
|
||||
|
||||
/* If non-zero, readline will install a signal handler for SIGWINCH
|
||||
that also attempts to call any calling application's SIGWINCH signal
|
||||
handler. Note that the terminal is not cleaned up before the
|
||||
application's signal handler is called; use rl_cleanup_after_signal()
|
||||
to do that. */
|
||||
extern int rl_catch_sigwinch;
|
||||
|
||||
/* Completion variables. */
|
||||
/* Pointer to the generator function for completion_matches ().
|
||||
NULL means to use filename_entry_function (), the default filename
|
||||
@ -340,6 +538,15 @@ extern Function *rl_directory_completion_hook;
|
||||
/* Backwards compatibility with previous versions of readline. */
|
||||
#define rl_symbolic_link_hook rl_directory_completion_hook
|
||||
|
||||
/* If non-zero, then this is the address of a function to call when
|
||||
completing a word would normally display the list of possible matches.
|
||||
This function is called instead of actually doing the display.
|
||||
It takes three arguments: (char **matches, int num_matches, int max_length)
|
||||
where MATCHES is the array of strings that matched, NUM_MATCHES is the
|
||||
number of strings in that array, and MAX_LENGTH is the length of the
|
||||
longest string in that array. */
|
||||
extern VFunction *rl_completion_display_matches_hook;
|
||||
|
||||
/* Non-zero means that the results of the matches are to be treated
|
||||
as filenames. This is ALWAYS zero on entry, and can only be changed
|
||||
within a completion entry finder function. */
|
||||
@ -408,4 +615,8 @@ extern int rl_inhibit_completion;
|
||||
extern char *savestring (); /* XXX backwards compatibility */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _READLINE_H_ */
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
/* If defined, readline shows opening parens and braces when closing
|
||||
paren or brace entered. */
|
||||
#define PAREN_MATCHING
|
||||
/* #define PAREN_MATCHING */
|
||||
|
||||
/* This definition is needed by readline.c, rltty.c, and signals.c. */
|
||||
/* If on, then readline handles signals in a way that doesn't screw. */
|
||||
@ -56,8 +56,6 @@
|
||||
|
||||
/* Define this if you want code that allows readline to be used in an
|
||||
X `callback' style. */
|
||||
#if !defined (SHELL)
|
||||
# define READLINE_CALLBACKS
|
||||
#endif
|
||||
#define READLINE_CALLBACKS
|
||||
|
||||
#endif /* _RLCONF_H_ */
|
||||
|
@ -1,33 +0,0 @@
|
||||
/* savestring.c */
|
||||
|
||||
/* Copyright (C) 1998 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.
|
||||
|
||||
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 1, 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
|
||||
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,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
extern char *strcpy ();
|
||||
extern char *xmalloc ();
|
||||
|
||||
/* Backwards compatibility, now that savestring has been removed from
|
||||
all `public' readline header files. */
|
||||
char *
|
||||
savestring (s)
|
||||
char *s;
|
||||
{
|
||||
return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
|
||||
}
|
@ -26,10 +26,9 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# ifdef _MINIX
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
@ -45,22 +44,16 @@
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
#include <pwd.h>
|
||||
|
||||
#if !defined (SHELL)
|
||||
#if !defined (HAVE_GETPW_DECLS)
|
||||
extern struct passwd *getpwuid ();
|
||||
#endif /* !HAVE_GETPW_DECLS */
|
||||
|
||||
#ifdef savestring
|
||||
#undef savestring
|
||||
#endif
|
||||
extern char *xmalloc ();
|
||||
|
||||
/* Backwards compatibility, now that savestring has been removed from
|
||||
all `public' readline header files. */
|
||||
char *
|
||||
rl_savestring (s)
|
||||
char *s;
|
||||
{
|
||||
return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
|
||||
}
|
||||
/* All of these functions are resolved from bash if we are linking readline
|
||||
as part of bash. */
|
||||
|
||||
/* Does shell-like quoting using single quotes. */
|
||||
char *
|
||||
@ -126,13 +119,15 @@ get_env_value (varname)
|
||||
return ((char *)getenv (varname));
|
||||
}
|
||||
|
||||
#else /* SHELL */
|
||||
extern char *get_string_value ();
|
||||
|
||||
char *
|
||||
get_env_value (varname)
|
||||
char *varname;
|
||||
get_home_dir ()
|
||||
{
|
||||
return get_string_value (varname);
|
||||
}
|
||||
#endif /* SHELL */
|
||||
char *home_dir;
|
||||
struct passwd *entry;
|
||||
|
||||
home_dir = (char *)NULL;
|
||||
entry = getpwuid (getuid ());
|
||||
if (entry)
|
||||
home_dir = entry->pw_dir;
|
||||
return (home_dir);
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ extern int _rl_defining_kbd_macro;
|
||||
extern char *_rl_executing_macro;
|
||||
|
||||
/* Pseudo-global functions imported from other library files. */
|
||||
extern void _rl_replace_text ();
|
||||
extern void _rl_pop_executing_macro ();
|
||||
extern void _rl_set_the_line ();
|
||||
extern void _rl_init_argument ();
|
||||
@ -124,7 +125,7 @@ rl_tty_status (count, key)
|
||||
{
|
||||
#if defined (TIOCSTAT)
|
||||
ioctl (1, TIOCSTAT, (char *)0);
|
||||
rl_refresh_line ();
|
||||
rl_refresh_line (count, key);
|
||||
#else
|
||||
ding ();
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user