mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-03 02:10:50 +02:00
commit bash-20150724 snapshot
This commit is contained in:
@@ -161,6 +161,36 @@ rl_callback_read_char ()
|
||||
CALLBACK_READ_RETURN ();
|
||||
}
|
||||
#if defined (VI_MODE)
|
||||
/* States that can occur while in state VIMOTION have to be checked
|
||||
before RL_STATE_VIMOTION */
|
||||
else if (RL_ISSTATE (RL_STATE_CHARSEARCH))
|
||||
{
|
||||
int k;
|
||||
|
||||
k = _rl_callback_data->i2;
|
||||
|
||||
eof = (*_rl_callback_func) (_rl_callback_data);
|
||||
/* If the function `deregisters' itself, make sure the data is
|
||||
cleaned up. */
|
||||
if (_rl_callback_func == 0) /* XXX - just sanity check */
|
||||
{
|
||||
if (_rl_callback_data)
|
||||
{
|
||||
_rl_callback_data_dispose (_rl_callback_data);
|
||||
_rl_callback_data = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Messy case where vi motion command can be char search */
|
||||
if (RL_ISSTATE (RL_STATE_VIMOTION))
|
||||
{
|
||||
_rl_vi_domove_motion_cleanup (k, _rl_vimvcxt);
|
||||
_rl_internal_char_cleanup ();
|
||||
CALLBACK_READ_RETURN ();
|
||||
}
|
||||
|
||||
_rl_internal_char_cleanup ();
|
||||
}
|
||||
else if (RL_ISSTATE (RL_STATE_VIMOTION))
|
||||
{
|
||||
eof = _rl_vi_domove_callback (_rl_vimvcxt);
|
||||
@@ -311,6 +341,8 @@ rl_callback_sigcleanup ()
|
||||
}
|
||||
else if (RL_ISSTATE (RL_STATE_MULTIKEY))
|
||||
RL_UNSETSTATE (RL_STATE_MULTIKEY);
|
||||
if (RL_ISSTATE (RL_STATE_CHARSEARCH))
|
||||
RL_UNSETSTATE (RL_STATE_CHARSEARCH);
|
||||
|
||||
_rl_callback_func = 0;
|
||||
}
|
||||
|
||||
@@ -916,8 +916,10 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
||||
default) or a timeout determined by the value of `keyseq-timeout' */
|
||||
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued
|
||||
takes microseconds, so multiply by 1000 */
|
||||
if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap
|
||||
&& _rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0)
|
||||
if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap &&
|
||||
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
|
||||
_rl_pushed_input_available () == 0 &&
|
||||
_rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0)
|
||||
return (_rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)));
|
||||
#endif
|
||||
|
||||
@@ -954,7 +956,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
||||
/* Tentative inter-character timeout for potential multi-key
|
||||
sequences? If no input within timeout, abort sequence and
|
||||
act as if we got non-matching input. */
|
||||
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued
|
||||
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued[B
|
||||
takes microseconds, so multiply by 1000 */
|
||||
if (_rl_keyseq_timeout > 0 &&
|
||||
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
|
||||
|
||||
@@ -870,7 +870,8 @@ extern int rl_inhibit_completion;
|
||||
#define RL_STATE_VIMOTION 0x0100000 /* reading vi motion arg */
|
||||
#define RL_STATE_MULTIKEY 0x0200000 /* reading multiple-key command */
|
||||
#define RL_STATE_VICMDONCE 0x0400000 /* entered vi command mode at least once */
|
||||
#define RL_STATE_REDISPLAYING 0x0800000 /* updating terminal display */
|
||||
#define RL_STATE_CHARSEARCH 0x0800000 /* vi mode char search */
|
||||
#define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */
|
||||
|
||||
#define RL_STATE_DONE 0x1000000 /* done; accepted line */
|
||||
|
||||
|
||||
@@ -427,6 +427,7 @@ extern int _rl_vi_textmod_command PARAMS((int));
|
||||
extern int _rl_vi_motion_command PARAMS((int));
|
||||
extern void _rl_vi_done_inserting PARAMS((void));
|
||||
extern int _rl_vi_domove_callback PARAMS((_rl_vimotion_cxt *));
|
||||
extern int _rl_vi_domove_motion_cleanup PARAMS((int, _rl_vimotion_cxt *));
|
||||
|
||||
/*************************************************************************
|
||||
* Undocumented private variables *
|
||||
|
||||
+41
-8
@@ -1096,28 +1096,55 @@ static int
|
||||
rl_domove_motion_callback (m)
|
||||
_rl_vimotion_cxt *m;
|
||||
{
|
||||
int c, save, r;
|
||||
int old_end;
|
||||
int c;
|
||||
|
||||
_rl_vi_last_motion = c = m->motion;
|
||||
|
||||
/* Append a blank character temporarily so that the motion routines
|
||||
work right at the end of the line. */
|
||||
old_end = rl_end;
|
||||
work right at the end of the line. Original value of rl_end is saved
|
||||
as m->end. */
|
||||
rl_line_buffer[rl_end++] = ' ';
|
||||
rl_line_buffer[rl_end] = '\0';
|
||||
|
||||
_rl_dispatch (c, _rl_keymap);
|
||||
|
||||
/* Remove the blank that we added. */
|
||||
rl_end = old_end;
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
if (RL_ISSTATE (RL_STATE_CALLBACK))
|
||||
{
|
||||
/* Messy case where char search can be vi motion command; see rest of
|
||||
details in callback.c. vi_char_search and callback_char_search just
|
||||
set and unset the CHARSEARCH state. This is where any vi motion
|
||||
command that needs to set its own state should be handled, with any
|
||||
corresponding code to manage that state in callback.c */
|
||||
if (RL_ISSTATE (RL_STATE_CHARSEARCH))
|
||||
return 0;
|
||||
else
|
||||
return (_rl_vi_domove_motion_cleanup (c, m));
|
||||
}
|
||||
#endif
|
||||
|
||||
return (_rl_vi_domove_motion_cleanup (c, m));
|
||||
}
|
||||
|
||||
int
|
||||
_rl_vi_domove_motion_cleanup (c, m)
|
||||
int c;
|
||||
_rl_vimotion_cxt *m;
|
||||
{
|
||||
int r;
|
||||
|
||||
/* Remove the blank that we added in rl_domove_motion_callback. */
|
||||
rl_end = m->end;
|
||||
rl_line_buffer[rl_end] = '\0';
|
||||
if (rl_point > rl_end)
|
||||
rl_point = rl_end;
|
||||
|
||||
/* No change in position means the command failed. */
|
||||
if (rl_mark == rl_point)
|
||||
return (-1);
|
||||
{
|
||||
RL_UNSETSTATE (RL_STATE_VIMOTION);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* rl_vi_f[wW]ord () leaves the cursor on the first character of the next
|
||||
word. If we are not at the end of the line, and we are on a
|
||||
@@ -1625,7 +1652,10 @@ _rl_vi_callback_char_search (data)
|
||||
#endif
|
||||
|
||||
if (c <= 0)
|
||||
return -1;
|
||||
{
|
||||
RL_UNSETSTATE (RL_STATE_CHARSEARCH);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if !defined (HANDLE_MULTIBYTE)
|
||||
_rl_vi_last_search_char = c;
|
||||
@@ -1633,6 +1663,7 @@ _rl_vi_callback_char_search (data)
|
||||
|
||||
_rl_callback_func = 0;
|
||||
_rl_want_redisplay = 1;
|
||||
RL_UNSETSTATE (RL_STATE_CHARSEARCH);
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
return (_rl_char_search_internal (data->count, _rl_cs_dir, _rl_vi_last_search_mbchar, _rl_vi_last_search_mblen));
|
||||
@@ -1697,7 +1728,9 @@ rl_vi_char_search (count, key)
|
||||
{
|
||||
_rl_callback_data = _rl_callback_data_alloc (count);
|
||||
_rl_callback_data->i1 = _rl_cs_dir;
|
||||
_rl_callback_data->i2 = key;
|
||||
_rl_callback_func = _rl_vi_callback_char_search;
|
||||
RL_SETSTATE (RL_STATE_CHARSEARCH);
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -148,8 +148,11 @@ sh_double_quote (string)
|
||||
/* Backslash-newline disappears within double quotes, so don't add one. */
|
||||
if ((sh_syntaxtab[c] & CBSDQUOTE) && c != '\n')
|
||||
*r++ = '\\';
|
||||
#if 0
|
||||
/* Assume that the string will not be further expanded. */
|
||||
else if (c == CTLESC || c == CTLNUL)
|
||||
*r++ = CTLESC; /* could be '\\'? */
|
||||
#endif
|
||||
|
||||
*r++ = c;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user