1,2c1
< /* $FreeBSD: head/contrib/libreadline/vi_mode.c 136759 2004-10-21 20:10:14Z peter $ */
<
---
> /* $FreeBSD: head/contrib/libreadline/vi_mode.c 157188 2006-03-27 23:11:32Z ache $ */
6c5
< /* Copyright (C) 1987-2004 Free Software Foundation, Inc.
---
> /* Copyright (C) 1987-2005 Free Software Foundation, Inc.
94a94
> static int _rl_vi_last_search_mblen;
111a112,113
>
> static int _rl_vi_arg_dispatch PARAMS((int));
113a116,127
> static int _rl_vi_set_mark PARAMS((void));
> static int _rl_vi_goto_mark PARAMS((void));
>
> static int _rl_vi_callback_getchar PARAMS((char *, int));
>
> #if defined (READLINE_CALLBACKS)
> static int _rl_vi_callback_set_mark PARAMS((_rl_callback_generic_arg *));
> static int _rl_vi_callback_goto_mark PARAMS((_rl_callback_generic_arg *));
> static int _rl_vi_callback_change_char PARAMS((_rl_callback_generic_arg *));
> static int _rl_vi_callback_char_search PARAMS((_rl_callback_generic_arg *));
> #endif
>
120a135,136
>
> RL_UNSETSTATE(RL_STATE_VICMDONCE);
675a692,698
>
> /* This is how POSIX.2 says `U' should behave -- everything up until the
> first time you go into command mode should not be undone. */
> if (RL_ISSTATE (RL_STATE_VICMDONCE) == 0)
> rl_free_undo_list ();
>
> RL_SETSTATE (RL_STATE_VICMDONCE);
844a868
> RL_SETSTATE (RL_STATE_NUMERICARG|RL_STATE_VIMOTION);
845a870
> RL_UNSETSTATE (RL_STATE_VIMOTION);
917a943,977
> /* Process C as part of the current numeric argument. Return -1 if the
> argument should be aborted, 0 if we should not read any more chars, and
> 1 if we should continue to read chars. */
> static int
> _rl_vi_arg_dispatch (c)
> int c;
> {
> int key;
>
> key = c;
> if (c >= 0 && _rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument)
> {
> rl_numeric_arg *= 4;
> return 1;
> }
>
> c = UNMETA (c);
>
> if (_rl_digit_p (c))
> {
> if (rl_explicit_arg)
> rl_numeric_arg = (rl_numeric_arg * 10) + _rl_digit_value (c);
> else
> rl_numeric_arg = _rl_digit_value (c);
> rl_explicit_arg = 1;
> return 1;
> }
> else
> {
> rl_clear_message ();
> rl_stuff_char (key);
> return 0;
> }
> }
>
924c984
< int key, c;
---
> int c, r;
926d985
< RL_SETSTATE(RL_STATE_NUMERICARG);
929,940c988,989
< 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);
< RL_SETSTATE(RL_STATE_MOREINPUT);
< key = c = rl_read_key ();
< RL_UNSETSTATE(RL_STATE_MOREINPUT);
---
> if (_rl_arg_overflow ())
> return 1;
942,947c991
< if (c >= 0 && _rl_keymap[c].type == ISFUNC &&
< _rl_keymap[c].function == rl_universal_argument)
< {
< rl_numeric_arg *= 4;
< continue;
< }
---
> c = _rl_arg_getchar ();
949,963c993,995
< c = UNMETA (c);
< if (_rl_digit_p (c))
< {
< if (rl_explicit_arg)
< rl_numeric_arg = (rl_numeric_arg * 10) + _rl_digit_value (c);
< else
< rl_numeric_arg = _rl_digit_value (c);
< rl_explicit_arg = 1;
< }
< else
< {
< rl_clear_message ();
< rl_stuff_char (key);
< break;
< }
---
> r = _rl_vi_arg_dispatch (c);
> if (r <= 0)
> break;
1053c1085
< int c, save = rl_point;
---
> int c, save;
1054a1087
> save = rl_point;
1078a1112,1142
> rl_vi_rubout (count, key)
> int count, key;
> {
> int p, opoint;
>
> if (count < 0)
> return (rl_vi_delete (-count, key));
>
> if (rl_point == 0)
> {
> rl_ding ();
> return -1;
> }
>
> opoint = rl_point;
> if (count > 1 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
> rl_backward_char (count, key);
> else if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
> rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
> else
> rl_point -= count;
>
> if (rl_point < 0)
> rl_point = 0;
>
> rl_kill_text (rl_point, opoint);
>
> return (0);
> }
>
> int
1083a1148,1150
> if (count < 0)
> return (rl_vi_rubout (-count, key));
>
1101a1169
>
1121a1190,1215
> static int _rl_cs_dir, _rl_cs_orig_dir;
>
> #if defined (READLINE_CALLBACKS)
> static int
> _rl_vi_callback_char_search (data)
> _rl_callback_generic_arg *data;
> {
> #if defined (HANDLE_MULTIBYTE)
> _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
> #else
> RL_SETSTATE(RL_STATE_MOREINPUT);
> _rl_vi_last_search_char = rl_read_key ();
> RL_UNSETSTATE(RL_STATE_MOREINPUT);
> #endif
>
> _rl_callback_func = 0;
> _rl_want_redisplay = 1;
>
> #if defined (HANDLE_MULTIBYTE)
> return (_rl_char_search_internal (data->count, _rl_cs_dir, _rl_vi_last_search_mbchar, _rl_vi_last_search_mblen));
> #else
> return (_rl_char_search_internal (data->count, _rl_cs_dir, _rl_vi_last_search_char));
> #endif
> }
> #endif
>
1128c1222
< static int mb_len;
---
> static int tlen;
1132d1225
< static int orig_dir, dir;
1135c1228
< dir = key == ';' ? orig_dir : -orig_dir;
---
> _rl_cs_dir = (key == ';') ? _rl_cs_orig_dir : -_rl_cs_orig_dir;
1138,1155d1230
< if (vi_redoing)
< #if defined (HANDLE_MULTIBYTE)
< target = _rl_vi_last_search_mbchar;
< #else
< target = _rl_vi_last_search_char;
< #endif
< else
< {
< #if defined (HANDLE_MULTIBYTE)
< mb_len = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
< target = _rl_vi_last_search_mbchar;
< #else
< RL_SETSTATE(RL_STATE_MOREINPUT);
< _rl_vi_last_search_char = target = rl_read_key ();
< RL_UNSETSTATE(RL_STATE_MOREINPUT);
< #endif
< }
<
1159c1234
< orig_dir = dir = FTO;
---
> _rl_cs_orig_dir = _rl_cs_dir = FTO;
1163c1238
< orig_dir = dir = BTO;
---
> _rl_cs_orig_dir = _rl_cs_dir = BTO;
1167c1242
< orig_dir = dir = FFIND;
---
> _rl_cs_orig_dir = _rl_cs_dir = FFIND;
1171c1246
< orig_dir = dir = BFIND;
---
> _rl_cs_orig_dir = _rl_cs_dir = BFIND;
1173a1249,1272
>
> if (vi_redoing)
> {
> /* set target and tlen below */
> }
> #if defined (READLINE_CALLBACKS)
> else if (RL_ISSTATE (RL_STATE_CALLBACK))
> {
> _rl_callback_data = _rl_callback_data_alloc (count);
> _rl_callback_data->i1 = _rl_cs_dir;
> _rl_callback_func = _rl_vi_callback_char_search;
> return (0);
> }
> #endif
> else
> {
> #if defined (HANDLE_MULTIBYTE)
> _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
> #else
> RL_SETSTATE(RL_STATE_MOREINPUT);
> _rl_vi_last_search_char = rl_read_key ();
> RL_UNSETSTATE(RL_STATE_MOREINPUT);
> #endif
> }
1177c1276,1277
< return (_rl_char_search_internal (count, dir, target, mb_len));
---
> target = _rl_vi_last_search_mbchar;
> tlen = _rl_vi_last_search_mblen;
1179c1279
< return (_rl_char_search_internal (count, dir, target));
---
> target = _rl_vi_last_search_char;
1180a1281,1286
>
> #if defined (HANDLE_MULTIBYTE)
> return (_rl_char_search_internal (count, _rl_cs_dir, target, tlen));
> #else
> return (_rl_char_search_internal (count, _rl_cs_dir, target));
> #endif
1290,1297c1396,1399
< /* XXX - think about reading an entire mbchar with _rl_read_mbchar and
< inserting it in one bunch instead of the loop below (like in
< rl_vi_char_search or _rl_vi_change_mbchar_case). Set c to mbchar[0]
< for test against 033 or ^C. Make sure that _rl_read_mbchar does
< this right. */
< int
< rl_vi_change_char (count, key)
< int count, key;
---
> static int
> _rl_vi_change_char (count, c, mb)
> int count, c;
> char *mb;
1299c1401
< int c, p;
---
> int p;
1301,1309d1402
< if (vi_redoing)
< c = _rl_vi_last_replacement;
< else
< {
< RL_SETSTATE(RL_STATE_MOREINPUT);
< _rl_vi_last_replacement = c = rl_read_key ();
< RL_UNSETSTATE(RL_STATE_MOREINPUT);
< }
<
1317a1411,1412
> if (rl_point < p) /* Did we retreat at EOL? */
> rl_point++;
1320,1329c1415
< {
< if (rl_point < p) /* Did we retreat at EOL? */
< rl_point++;
< while (_rl_insert_char (1, c))
< {
< RL_SETSTATE (RL_STATE_MOREINPUT);
< c = rl_read_key ();
< RL_UNSETSTATE (RL_STATE_MOREINPUT);
< }
< }
---
> rl_insert_text (mb);
1332,1336c1418
< {
< if (rl_point < p) /* Did we retreat at EOL? */
< rl_point++;
< _rl_insert_char (1, c);
< }
---
> _rl_insert_char (1, c);
1337a1420,1423
>
> /* The cursor shall be left on the last character changed. */
> rl_backward_char (1, c);
>
1342a1429,1464
> static int
> _rl_vi_callback_getchar (mb, mblen)
> char *mb;
> int mblen;
> {
> int c;
>
> RL_SETSTATE(RL_STATE_MOREINPUT);
> c = rl_read_key ();
> RL_UNSETSTATE(RL_STATE_MOREINPUT);
>
> #if defined (HANDLE_MULTIBYTE)
> if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
> c = _rl_read_mbstring (c, mb, mblen);
> #endif
>
> return c;
> }
>
> #if defined (READLINE_CALLBACKS)
> static int
> _rl_vi_callback_change_char (data)
> _rl_callback_generic_arg *data;
> {
> int c;
> char mb[MB_LEN_MAX];
>
> _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
>
> _rl_callback_func = 0;
> _rl_want_redisplay = 1;
>
> return (_rl_vi_change_char (data->count, c, mb));
> }
> #endif
>
1343a1466,1492
> rl_vi_change_char (count, key)
> int count, key;
> {
> int c;
> char mb[MB_LEN_MAX];
>
> if (vi_redoing)
> {
> c = _rl_vi_last_replacement;
> mb[0] = c;
> mb[1] = '\0';
> }
> #if defined (READLINE_CALLBACKS)
> else if (RL_ISSTATE (RL_STATE_CALLBACK))
> {
> _rl_callback_data = _rl_callback_data_alloc (count);
> _rl_callback_func = _rl_vi_callback_change_char;
> return (0);
> }
> #endif
> else
> _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
>
> return (_rl_vi_change_char (count, c, mb));
> }
>
> int
1465,1467c1614,1615
< int
< rl_vi_set_mark (count, key)
< int count, key;
---
> static int
> _rl_vi_set_mark ()
1484a1633,1644
> #if defined (READLINE_CALLBACKS)
> static int
> _rl_vi_callback_set_mark (data)
> _rl_callback_generic_arg *data;
> {
> _rl_callback_func = 0;
> _rl_want_redisplay = 1;
>
> return (_rl_vi_set_mark ());
> }
> #endif
>
1486c1646
< rl_vi_goto_mark (count, key)
---
> rl_vi_set_mark (count, key)
1488a1649,1663
> #if defined (READLINE_CALLBACKS)
> if (RL_ISSTATE (RL_STATE_CALLBACK))
> {
> _rl_callback_data = 0;
> _rl_callback_func = _rl_vi_callback_set_mark;
> return (0);
> }
> #endif
>
> return (_rl_vi_set_mark ());
> }
>
> static int
> _rl_vi_goto_mark ()
> {
1515a1691,1717
> #if defined (READLINE_CALLBACKS)
> static int
> _rl_vi_callback_goto_mark (data)
> _rl_callback_generic_arg *data;
> {
> _rl_callback_func = 0;
> _rl_want_redisplay = 1;
>
> return (_rl_vi_goto_mark ());
> }
> #endif
>
> int
> rl_vi_goto_mark (count, key)
> int count, key;
> {
> #if defined (READLINE_CALLBACKS)
> if (RL_ISSTATE (RL_STATE_CALLBACK))
> {
> _rl_callback_data = 0;
> _rl_callback_func = _rl_vi_callback_goto_mark;
> return (0);
> }
> #endif
>
> return (_rl_vi_goto_mark ());
> }
< /* $FreeBSD: head/contrib/libreadline/vi_mode.c 136759 2004-10-21 20:10:14Z peter $ */
<
---
> /* $FreeBSD: head/contrib/libreadline/vi_mode.c 157188 2006-03-27 23:11:32Z ache $ */
6c5
< /* Copyright (C) 1987-2004 Free Software Foundation, Inc.
---
> /* Copyright (C) 1987-2005 Free Software Foundation, Inc.
94a94
> static int _rl_vi_last_search_mblen;
111a112,113
>
> static int _rl_vi_arg_dispatch PARAMS((int));
113a116,127
> static int _rl_vi_set_mark PARAMS((void));
> static int _rl_vi_goto_mark PARAMS((void));
>
> static int _rl_vi_callback_getchar PARAMS((char *, int));
>
> #if defined (READLINE_CALLBACKS)
> static int _rl_vi_callback_set_mark PARAMS((_rl_callback_generic_arg *));
> static int _rl_vi_callback_goto_mark PARAMS((_rl_callback_generic_arg *));
> static int _rl_vi_callback_change_char PARAMS((_rl_callback_generic_arg *));
> static int _rl_vi_callback_char_search PARAMS((_rl_callback_generic_arg *));
> #endif
>
120a135,136
>
> RL_UNSETSTATE(RL_STATE_VICMDONCE);
675a692,698
>
> /* This is how POSIX.2 says `U' should behave -- everything up until the
> first time you go into command mode should not be undone. */
> if (RL_ISSTATE (RL_STATE_VICMDONCE) == 0)
> rl_free_undo_list ();
>
> RL_SETSTATE (RL_STATE_VICMDONCE);
844a868
> RL_SETSTATE (RL_STATE_NUMERICARG|RL_STATE_VIMOTION);
845a870
> RL_UNSETSTATE (RL_STATE_VIMOTION);
917a943,977
> /* Process C as part of the current numeric argument. Return -1 if the
> argument should be aborted, 0 if we should not read any more chars, and
> 1 if we should continue to read chars. */
> static int
> _rl_vi_arg_dispatch (c)
> int c;
> {
> int key;
>
> key = c;
> if (c >= 0 && _rl_keymap[c].type == ISFUNC && _rl_keymap[c].function == rl_universal_argument)
> {
> rl_numeric_arg *= 4;
> return 1;
> }
>
> c = UNMETA (c);
>
> if (_rl_digit_p (c))
> {
> if (rl_explicit_arg)
> rl_numeric_arg = (rl_numeric_arg * 10) + _rl_digit_value (c);
> else
> rl_numeric_arg = _rl_digit_value (c);
> rl_explicit_arg = 1;
> return 1;
> }
> else
> {
> rl_clear_message ();
> rl_stuff_char (key);
> return 0;
> }
> }
>
924c984
< int key, c;
---
> int c, r;
926d985
< RL_SETSTATE(RL_STATE_NUMERICARG);
929,940c988,989
< 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);
< RL_SETSTATE(RL_STATE_MOREINPUT);
< key = c = rl_read_key ();
< RL_UNSETSTATE(RL_STATE_MOREINPUT);
---
> if (_rl_arg_overflow ())
> return 1;
942,947c991
< if (c >= 0 && _rl_keymap[c].type == ISFUNC &&
< _rl_keymap[c].function == rl_universal_argument)
< {
< rl_numeric_arg *= 4;
< continue;
< }
---
> c = _rl_arg_getchar ();
949,963c993,995
< c = UNMETA (c);
< if (_rl_digit_p (c))
< {
< if (rl_explicit_arg)
< rl_numeric_arg = (rl_numeric_arg * 10) + _rl_digit_value (c);
< else
< rl_numeric_arg = _rl_digit_value (c);
< rl_explicit_arg = 1;
< }
< else
< {
< rl_clear_message ();
< rl_stuff_char (key);
< break;
< }
---
> r = _rl_vi_arg_dispatch (c);
> if (r <= 0)
> break;
1053c1085
< int c, save = rl_point;
---
> int c, save;
1054a1087
> save = rl_point;
1078a1112,1142
> rl_vi_rubout (count, key)
> int count, key;
> {
> int p, opoint;
>
> if (count < 0)
> return (rl_vi_delete (-count, key));
>
> if (rl_point == 0)
> {
> rl_ding ();
> return -1;
> }
>
> opoint = rl_point;
> if (count > 1 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
> rl_backward_char (count, key);
> else if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
> rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
> else
> rl_point -= count;
>
> if (rl_point < 0)
> rl_point = 0;
>
> rl_kill_text (rl_point, opoint);
>
> return (0);
> }
>
> int
1083a1148,1150
> if (count < 0)
> return (rl_vi_rubout (-count, key));
>
1101a1169
>
1121a1190,1215
> static int _rl_cs_dir, _rl_cs_orig_dir;
>
> #if defined (READLINE_CALLBACKS)
> static int
> _rl_vi_callback_char_search (data)
> _rl_callback_generic_arg *data;
> {
> #if defined (HANDLE_MULTIBYTE)
> _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
> #else
> RL_SETSTATE(RL_STATE_MOREINPUT);
> _rl_vi_last_search_char = rl_read_key ();
> RL_UNSETSTATE(RL_STATE_MOREINPUT);
> #endif
>
> _rl_callback_func = 0;
> _rl_want_redisplay = 1;
>
> #if defined (HANDLE_MULTIBYTE)
> return (_rl_char_search_internal (data->count, _rl_cs_dir, _rl_vi_last_search_mbchar, _rl_vi_last_search_mblen));
> #else
> return (_rl_char_search_internal (data->count, _rl_cs_dir, _rl_vi_last_search_char));
> #endif
> }
> #endif
>
1128c1222
< static int mb_len;
---
> static int tlen;
1132d1225
< static int orig_dir, dir;
1135c1228
< dir = key == ';' ? orig_dir : -orig_dir;
---
> _rl_cs_dir = (key == ';') ? _rl_cs_orig_dir : -_rl_cs_orig_dir;
1138,1155d1230
< if (vi_redoing)
< #if defined (HANDLE_MULTIBYTE)
< target = _rl_vi_last_search_mbchar;
< #else
< target = _rl_vi_last_search_char;
< #endif
< else
< {
< #if defined (HANDLE_MULTIBYTE)
< mb_len = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
< target = _rl_vi_last_search_mbchar;
< #else
< RL_SETSTATE(RL_STATE_MOREINPUT);
< _rl_vi_last_search_char = target = rl_read_key ();
< RL_UNSETSTATE(RL_STATE_MOREINPUT);
< #endif
< }
<
1159c1234
< orig_dir = dir = FTO;
---
> _rl_cs_orig_dir = _rl_cs_dir = FTO;
1163c1238
< orig_dir = dir = BTO;
---
> _rl_cs_orig_dir = _rl_cs_dir = BTO;
1167c1242
< orig_dir = dir = FFIND;
---
> _rl_cs_orig_dir = _rl_cs_dir = FFIND;
1171c1246
< orig_dir = dir = BFIND;
---
> _rl_cs_orig_dir = _rl_cs_dir = BFIND;
1173a1249,1272
>
> if (vi_redoing)
> {
> /* set target and tlen below */
> }
> #if defined (READLINE_CALLBACKS)
> else if (RL_ISSTATE (RL_STATE_CALLBACK))
> {
> _rl_callback_data = _rl_callback_data_alloc (count);
> _rl_callback_data->i1 = _rl_cs_dir;
> _rl_callback_func = _rl_vi_callback_char_search;
> return (0);
> }
> #endif
> else
> {
> #if defined (HANDLE_MULTIBYTE)
> _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
> #else
> RL_SETSTATE(RL_STATE_MOREINPUT);
> _rl_vi_last_search_char = rl_read_key ();
> RL_UNSETSTATE(RL_STATE_MOREINPUT);
> #endif
> }
1177c1276,1277
< return (_rl_char_search_internal (count, dir, target, mb_len));
---
> target = _rl_vi_last_search_mbchar;
> tlen = _rl_vi_last_search_mblen;
1179c1279
< return (_rl_char_search_internal (count, dir, target));
---
> target = _rl_vi_last_search_char;
1180a1281,1286
>
> #if defined (HANDLE_MULTIBYTE)
> return (_rl_char_search_internal (count, _rl_cs_dir, target, tlen));
> #else
> return (_rl_char_search_internal (count, _rl_cs_dir, target));
> #endif
1290,1297c1396,1399
< /* XXX - think about reading an entire mbchar with _rl_read_mbchar and
< inserting it in one bunch instead of the loop below (like in
< rl_vi_char_search or _rl_vi_change_mbchar_case). Set c to mbchar[0]
< for test against 033 or ^C. Make sure that _rl_read_mbchar does
< this right. */
< int
< rl_vi_change_char (count, key)
< int count, key;
---
> static int
> _rl_vi_change_char (count, c, mb)
> int count, c;
> char *mb;
1299c1401
< int c, p;
---
> int p;
1301,1309d1402
< if (vi_redoing)
< c = _rl_vi_last_replacement;
< else
< {
< RL_SETSTATE(RL_STATE_MOREINPUT);
< _rl_vi_last_replacement = c = rl_read_key ();
< RL_UNSETSTATE(RL_STATE_MOREINPUT);
< }
<
1317a1411,1412
> if (rl_point < p) /* Did we retreat at EOL? */
> rl_point++;
1320,1329c1415
< {
< if (rl_point < p) /* Did we retreat at EOL? */
< rl_point++;
< while (_rl_insert_char (1, c))
< {
< RL_SETSTATE (RL_STATE_MOREINPUT);
< c = rl_read_key ();
< RL_UNSETSTATE (RL_STATE_MOREINPUT);
< }
< }
---
> rl_insert_text (mb);
1332,1336c1418
< {
< if (rl_point < p) /* Did we retreat at EOL? */
< rl_point++;
< _rl_insert_char (1, c);
< }
---
> _rl_insert_char (1, c);
1337a1420,1423
>
> /* The cursor shall be left on the last character changed. */
> rl_backward_char (1, c);
>
1342a1429,1464
> static int
> _rl_vi_callback_getchar (mb, mblen)
> char *mb;
> int mblen;
> {
> int c;
>
> RL_SETSTATE(RL_STATE_MOREINPUT);
> c = rl_read_key ();
> RL_UNSETSTATE(RL_STATE_MOREINPUT);
>
> #if defined (HANDLE_MULTIBYTE)
> if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
> c = _rl_read_mbstring (c, mb, mblen);
> #endif
>
> return c;
> }
>
> #if defined (READLINE_CALLBACKS)
> static int
> _rl_vi_callback_change_char (data)
> _rl_callback_generic_arg *data;
> {
> int c;
> char mb[MB_LEN_MAX];
>
> _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
>
> _rl_callback_func = 0;
> _rl_want_redisplay = 1;
>
> return (_rl_vi_change_char (data->count, c, mb));
> }
> #endif
>
1343a1466,1492
> rl_vi_change_char (count, key)
> int count, key;
> {
> int c;
> char mb[MB_LEN_MAX];
>
> if (vi_redoing)
> {
> c = _rl_vi_last_replacement;
> mb[0] = c;
> mb[1] = '\0';
> }
> #if defined (READLINE_CALLBACKS)
> else if (RL_ISSTATE (RL_STATE_CALLBACK))
> {
> _rl_callback_data = _rl_callback_data_alloc (count);
> _rl_callback_func = _rl_vi_callback_change_char;
> return (0);
> }
> #endif
> else
> _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
>
> return (_rl_vi_change_char (count, c, mb));
> }
>
> int
1465,1467c1614,1615
< int
< rl_vi_set_mark (count, key)
< int count, key;
---
> static int
> _rl_vi_set_mark ()
1484a1633,1644
> #if defined (READLINE_CALLBACKS)
> static int
> _rl_vi_callback_set_mark (data)
> _rl_callback_generic_arg *data;
> {
> _rl_callback_func = 0;
> _rl_want_redisplay = 1;
>
> return (_rl_vi_set_mark ());
> }
> #endif
>
1486c1646
< rl_vi_goto_mark (count, key)
---
> rl_vi_set_mark (count, key)
1488a1649,1663
> #if defined (READLINE_CALLBACKS)
> if (RL_ISSTATE (RL_STATE_CALLBACK))
> {
> _rl_callback_data = 0;
> _rl_callback_func = _rl_vi_callback_set_mark;
> return (0);
> }
> #endif
>
> return (_rl_vi_set_mark ());
> }
>
> static int
> _rl_vi_goto_mark ()
> {
1515a1691,1717
> #if defined (READLINE_CALLBACKS)
> static int
> _rl_vi_callback_goto_mark (data)
> _rl_callback_generic_arg *data;
> {
> _rl_callback_func = 0;
> _rl_want_redisplay = 1;
>
> return (_rl_vi_goto_mark ());
> }
> #endif
>
> int
> rl_vi_goto_mark (count, key)
> int count, key;
> {
> #if defined (READLINE_CALLBACKS)
> if (RL_ISSTATE (RL_STATE_CALLBACK))
> {
> _rl_callback_data = 0;
> _rl_callback_func = _rl_vi_callback_goto_mark;
> return (0);
> }
> #endif
>
> return (_rl_vi_goto_mark ());
> }