static int _rl_vi_doing_insert;
/* Command keys which do movement for xxx_to commands. */
-static char *vi_motion = " hl^$0ftFt;,%wbeWBE|";
+static const char *vi_motion = " hl^$0ftFt;,%wbeWBE|";
/* Keymap used for vi replace characters. Created dynamically since
rarely used. */
static int vi_redoing;
/* Text modification commands. These are the `redoable' commands. */
-static char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
+static const char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
/* Arrays for the saved marks. */
static int vi_mark_chars[27];
break;
default:
- ding ();
+ rl_ding ();
break;
}
return (0);
if (rl_point == 0)
{
- ding ();
+ rl_ding ();
return (0);
}
if (rl_point >= (rl_end - 1))
{
- ding ();
+ rl_ding ();
return (0);
}
{
if (count < 0)
{
- ding ();
+ rl_ding ();
return -1;
}
int old_end;
rl_mark = rl_point;
+ RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
*nextkey = c;
if (!member (c, vi_motion))
rl_numeric_arg = _rl_digit_value (c);
rl_digit_loop1 ();
rl_numeric_arg *= save;
+ RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key (); /* real command */
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
*nextkey = c;
}
else if (key == c && (key == 'd' || key == 'y' || key == 'c'))
}
/* A simplified loop for vi. Don't dispatch key at end.
- Don't recognize minus sign? */
+ Don't recognize minus sign?
+ Should this do rl_save_prompt/rl_restore_prompt? */
static int
rl_digit_loop1 ()
{
int key, c;
+ RL_SETSTATE(RL_STATE_NUMERICARG);
while (1)
{
+ if (rl_numeric_arg > 1000000)
+ {
+ rl_explicit_arg = rl_numeric_arg = 0;
+ rl_ding ();
+ rl_clear_message ();
+ RL_UNSETSTATE(RL_STATE_NUMERICARG);
+ return 1;
+ }
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg, 0);
+ RL_SETSTATE(RL_STATE_MOREINPUT);
key = c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (_rl_keymap[c].type == ISFUNC &&
_rl_keymap[c].function == rl_universal_argument)
break;
}
}
+
+ RL_UNSETSTATE(RL_STATE_NUMERICARG);
return (0);
}
if (rl_vi_domove (key, &c))
{
- ding ();
+ rl_ding ();
return -1;
}
if (rl_vi_domove (key, &c))
{
- ding ();
+ rl_ding ();
return -1;
}
if (rl_vi_domove (key, &c))
{
- ding ();
+ rl_ding ();
return -1;
}
if (rl_end == 0)
{
- ding ();
+ rl_ding ();
return -1;
}
if (vi_redoing)
target = _rl_vi_last_search_char;
else
- _rl_vi_last_search_char = target = (*rl_getc_function) (rl_instream);
+ {
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ _rl_vi_last_search_char = target = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ }
switch (key)
{
if (brack <= 0)
{
rl_point = pos;
- ding ();
+ rl_ding ();
return -1;
}
}
}
else
{
- ding ();
+ rl_ding ();
return -1;
}
}
}
else
{
- ding ();
+ rl_ding ();
return -1;
}
}
if (vi_redoing)
c = _rl_vi_last_replacement;
else
- _rl_vi_last_replacement = c = (*rl_getc_function) (rl_instream);
+ {
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ _rl_vi_last_replacement = c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ }
if (c == '\033' || c == CTRL ('C'))
return -1;
{
if (vi_replace_count == 0)
{
- ding ();
+ rl_ding ();
break;
}
s = rl_point;
}
else if (rl_line_buffer[rl_point - 1] == ';')
{
- ding ();
+ rl_ding ();
return (0);
}
{
int ch;
+ RL_SETSTATE(RL_STATE_MOREINPUT);
ch = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
if (_rl_lowercase_p (ch) == 0)
{
- ding ();
+ rl_ding ();
return -1;
}
ch -= 'a';
{
int ch;
+ RL_SETSTATE(RL_STATE_MOREINPUT);
ch = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
if (ch == '`')
{
rl_point = rl_mark;
}
else if (_rl_lowercase_p (ch) == 0)
{
- ding ();
+ rl_ding ();
return -1;
}
ch -= 'a';
if (vi_mark_chars[ch] == -1)
{
- ding ();
+ rl_ding ();
return -1;
}
rl_point = vi_mark_chars[ch];