Submitted By: Matt Burgess (matthew at linuxfromscratch dot org)
Date: 2007-12-22
Initial Package Version: 5.2
Upstream Status: From Upstream
Origin: http://ftp.gnu.org/gnu/readline/readline-5.2-patches/
Description: A combined patch containing patches 001-012 from upstream.
diff -Naur readline-5.2.orig/complete.c readline-5.2/complete.c
old
|
new
|
|
428 | 428 | return (1); |
429 | 429 | if (c == 'n' || c == 'N' || c == RUBOUT) |
430 | 430 | return (0); |
431 | | if (c == ABORT_CHAR) |
| 431 | if (c == ABORT_CHAR || c < 0) |
432 | 432 | _rl_abort_internal (); |
433 | 433 | if (for_pager && (c == NEWLINE || c == RETURN)) |
434 | 434 | return (2); |
diff -Naur readline-5.2.orig/display.c readline-5.2/display.c
old
|
new
|
|
391 | 391 | t = ++p; |
392 | 392 | local_prompt = expand_prompt (p, &prompt_visible_length, |
393 | 393 | &prompt_last_invisible, |
394 | | (int *)NULL, |
| 394 | &prompt_invis_chars_first_line, |
395 | 395 | &prompt_physical_chars); |
396 | 396 | c = *t; *t = '\0'; |
397 | 397 | /* The portion of the prompt string up to and including the |
398 | 398 | final newline is now null-terminated. */ |
399 | 399 | local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, |
400 | 400 | (int *)NULL, |
401 | | &prompt_invis_chars_first_line, |
| 401 | (int *)NULL, |
402 | 402 | (int *)NULL); |
403 | 403 | *t = c; |
404 | 404 | local_prompt_len = local_prompt ? strlen (local_prompt) : 0; |
… |
… |
|
561 | 561 | wrap_offset = prompt_invis_chars_first_line = 0; |
562 | 562 | } |
563 | 563 | |
| 564 | #if defined (HANDLE_MULTIBYTE) |
| 565 | #define CHECK_INV_LBREAKS() \ |
| 566 | do { \ |
| 567 | if (newlines >= (inv_lbsize - 2)) \ |
| 568 | { \ |
| 569 | inv_lbsize *= 2; \ |
| 570 | inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ |
| 571 | _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \ |
| 572 | } \ |
| 573 | } while (0) |
| 574 | #else |
564 | 575 | #define CHECK_INV_LBREAKS() \ |
565 | 576 | do { \ |
566 | 577 | if (newlines >= (inv_lbsize - 2)) \ |
… |
… |
|
569 | 580 | inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ |
570 | 581 | } \ |
571 | 582 | } while (0) |
| 583 | #endif /* HANDLE_MULTIBYTE */ |
572 | 584 | |
573 | 585 | #if defined (HANDLE_MULTIBYTE) |
574 | 586 | #define CHECK_LPOS() \ |
… |
… |
|
1036 | 1048 | tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset; |
1037 | 1049 | else |
1038 | 1050 | tx = nleft; |
1039 | | if (_rl_last_c_pos > tx) |
| 1051 | if (tx >= 0 && _rl_last_c_pos > tx) |
1040 | 1052 | { |
1041 | 1053 | _rl_backspace (_rl_last_c_pos - tx); /* XXX */ |
1042 | 1054 | _rl_last_c_pos = tx; |
… |
… |
|
1192 | 1204 | int current_line, omax, nmax, inv_botlin; |
1193 | 1205 | { |
1194 | 1206 | register char *ofd, *ols, *oe, *nfd, *nls, *ne; |
1195 | | int temp, lendiff, wsatend, od, nd; |
| 1207 | int temp, lendiff, wsatend, od, nd, o_cpos; |
1196 | 1208 | int current_invis_chars; |
1197 | 1209 | int col_lendiff, col_temp; |
1198 | 1210 | #if defined (HANDLE_MULTIBYTE) |
… |
… |
|
1453 | 1465 | _rl_last_c_pos = lendiff; |
1454 | 1466 | } |
1455 | 1467 | |
| 1468 | o_cpos = _rl_last_c_pos; |
| 1469 | |
1456 | 1470 | /* When this function returns, _rl_last_c_pos is correct, and an absolute |
1457 | 1471 | cursor postion in multibyte mode, but a buffer index when not in a |
1458 | 1472 | multibyte locale. */ |
… |
… |
|
1462 | 1476 | /* We need to indicate that the cursor position is correct in the presence of |
1463 | 1477 | invisible characters in the prompt string. Let's see if setting this when |
1464 | 1478 | we make sure we're at the end of the drawn prompt string works. */ |
1465 | | if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars) |
| 1479 | if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && |
| 1480 | (_rl_last_c_pos > 0 || o_cpos > 0) && |
| 1481 | _rl_last_c_pos == prompt_physical_chars) |
1466 | 1482 | cpos_adjusted = 1; |
1467 | 1483 | #endif |
1468 | 1484 | #endif |
… |
… |
|
1506 | 1522 | { |
1507 | 1523 | /* Non-zero if we're increasing the number of lines. */ |
1508 | 1524 | int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin; |
| 1525 | /* If col_lendiff is > 0, implying that the new string takes up more |
| 1526 | screen real estate than the old, but lendiff is < 0, meaning that it |
| 1527 | takes fewer bytes, we need to just output the characters starting |
| 1528 | from the first difference. These will overwrite what is on the |
| 1529 | display, so there's no reason to do a smart update. This can really |
| 1530 | only happen in a multibyte environment. */ |
| 1531 | if (lendiff < 0) |
| 1532 | { |
| 1533 | _rl_output_some_chars (nfd, temp); |
| 1534 | _rl_last_c_pos += _rl_col_width (nfd, 0, temp); |
| 1535 | /* If nfd begins before any invisible characters in the prompt, |
| 1536 | adjust _rl_last_c_pos to account for wrap_offset and set |
| 1537 | cpos_adjusted to let the caller know. */ |
| 1538 | if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) |
| 1539 | { |
| 1540 | _rl_last_c_pos -= wrap_offset; |
| 1541 | cpos_adjusted = 1; |
| 1542 | } |
| 1543 | return; |
| 1544 | } |
1509 | 1545 | /* Sometimes it is cheaper to print the characters rather than |
1510 | 1546 | use the terminal's capabilities. If we're growing the number |
1511 | 1547 | of lines, make sure we actually cause the new line to wrap |
1512 | 1548 | around on auto-wrapping terminals. */ |
1513 | | if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) |
| 1549 | else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) |
1514 | 1550 | { |
1515 | 1551 | /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and |
1516 | 1552 | _rl_horizontal_scroll_mode == 1, inserting the characters with |
… |
… |
|
1533 | 1569 | } |
1534 | 1570 | else |
1535 | 1571 | { |
1536 | | /* We have horizontal scrolling and we are not inserting at |
1537 | | the end. We have invisible characters in this line. This |
1538 | | is a dumb update. */ |
1539 | 1572 | _rl_output_some_chars (nfd, temp); |
1540 | 1573 | _rl_last_c_pos += col_temp; |
| 1574 | /* If nfd begins before any invisible characters in the prompt, |
| 1575 | adjust _rl_last_c_pos to account for wrap_offset and set |
| 1576 | cpos_adjusted to let the caller know. */ |
| 1577 | if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) |
| 1578 | { |
| 1579 | _rl_last_c_pos -= wrap_offset; |
| 1580 | cpos_adjusted = 1; |
| 1581 | } |
1541 | 1582 | return; |
1542 | 1583 | } |
1543 | 1584 | /* Copy (new) chars to screen from first diff to last match. */ |
… |
… |
|
1586 | 1627 | temp = nls - nfd; |
1587 | 1628 | if (temp > 0) |
1588 | 1629 | { |
| 1630 | /* If nfd begins at the prompt, or before the invisible |
| 1631 | characters in the prompt, we need to adjust _rl_last_c_pos |
| 1632 | in a multibyte locale to account for the wrap offset and |
| 1633 | set cpos_adjusted accordingly. */ |
1589 | 1634 | _rl_output_some_chars (nfd, temp); |
1590 | | _rl_last_c_pos += _rl_col_width (nfd, 0, temp);; |
| 1635 | if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
| 1636 | { |
| 1637 | _rl_last_c_pos += _rl_col_width (nfd, 0, temp); |
| 1638 | if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) |
| 1639 | { |
| 1640 | _rl_last_c_pos -= wrap_offset; |
| 1641 | cpos_adjusted = 1; |
| 1642 | } |
| 1643 | } |
| 1644 | else |
| 1645 | _rl_last_c_pos += temp; |
1591 | 1646 | } |
1592 | 1647 | } |
1593 | 1648 | /* Otherwise, print over the existing material. */ |
… |
… |
|
1595 | 1650 | { |
1596 | 1651 | if (temp > 0) |
1597 | 1652 | { |
| 1653 | /* If nfd begins at the prompt, or before the invisible |
| 1654 | characters in the prompt, we need to adjust _rl_last_c_pos |
| 1655 | in a multibyte locale to account for the wrap offset and |
| 1656 | set cpos_adjusted accordingly. */ |
1598 | 1657 | _rl_output_some_chars (nfd, temp); |
1599 | 1658 | _rl_last_c_pos += col_temp; /* XXX */ |
| 1659 | if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
| 1660 | { |
| 1661 | if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) |
| 1662 | { |
| 1663 | _rl_last_c_pos -= wrap_offset; |
| 1664 | cpos_adjusted = 1; |
| 1665 | } |
| 1666 | } |
1600 | 1667 | } |
1601 | 1668 | lendiff = (oe - old) - (ne - new); |
1602 | 1669 | if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
… |
… |
|
1732 | 1799 | if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
1733 | 1800 | { |
1734 | 1801 | dpos = _rl_col_width (data, 0, new); |
1735 | | if (dpos > prompt_last_invisible) /* XXX - don't use woff here */ |
| 1802 | /* Use NEW when comparing against the last invisible character in the |
| 1803 | prompt string, since they're both buffer indices and DPOS is a |
| 1804 | desired display position. */ |
| 1805 | if (new > prompt_last_invisible) /* XXX - don't use woff here */ |
1736 | 1806 | { |
1737 | 1807 | dpos -= woff; |
1738 | 1808 | /* Since this will be assigned to _rl_last_c_pos at the end (more |
… |
… |
|
2380 | 2450 | |
2381 | 2451 | if (end <= start) |
2382 | 2452 | return 0; |
| 2453 | if (MB_CUR_MAX == 1 || rl_byte_oriented) |
| 2454 | return (end - start); |
2383 | 2455 | |
2384 | 2456 | memset (&ps, 0, sizeof (mbstate_t)); |
2385 | 2457 | |
diff -Naur readline-5.2.orig/input.c readline-5.2/input.c
old
|
new
|
|
133 | 133 | return (0); |
134 | 134 | |
135 | 135 | *key = ibuffer[pop_index++]; |
136 | | |
| 136 | #if 0 |
137 | 137 | if (pop_index >= ibuffer_len) |
| 138 | #else |
| 139 | if (pop_index > ibuffer_len) |
| 140 | #endif |
138 | 141 | pop_index = 0; |
139 | 142 | |
140 | 143 | return (1); |
… |
… |
|
151 | 154 | { |
152 | 155 | pop_index--; |
153 | 156 | if (pop_index < 0) |
154 | | pop_index = ibuffer_len - 1; |
| 157 | pop_index = ibuffer_len; |
155 | 158 | ibuffer[pop_index] = key; |
156 | 159 | return (1); |
157 | 160 | } |
… |
… |
|
250 | 253 | while (chars_avail--) |
251 | 254 | { |
252 | 255 | k = (*rl_getc_function) (rl_instream); |
253 | | rl_stuff_char (k); |
| 256 | if (rl_stuff_char (k) == 0) |
| 257 | break; /* some problem; no more room */ |
254 | 258 | if (k == NEWLINE || k == RETURN) |
255 | 259 | break; |
256 | 260 | } |
… |
… |
|
373 | 377 | RL_SETSTATE (RL_STATE_INPUTPENDING); |
374 | 378 | } |
375 | 379 | ibuffer[push_index++] = key; |
| 380 | #if 0 |
376 | 381 | if (push_index >= ibuffer_len) |
| 382 | #else |
| 383 | if (push_index > ibuffer_len) |
| 384 | #endif |
377 | 385 | push_index = 0; |
378 | 386 | |
379 | 387 | return 1; |
… |
… |
|
513 | 521 | char *mbchar; |
514 | 522 | int size; |
515 | 523 | { |
516 | | int mb_len = 0; |
| 524 | int mb_len, c; |
517 | 525 | size_t mbchar_bytes_length; |
518 | 526 | wchar_t wc; |
519 | 527 | mbstate_t ps, ps_back; |
520 | 528 | |
521 | 529 | memset(&ps, 0, sizeof (mbstate_t)); |
522 | 530 | memset(&ps_back, 0, sizeof (mbstate_t)); |
523 | | |
| 531 | |
| 532 | mb_len = 0; |
524 | 533 | while (mb_len < size) |
525 | 534 | { |
526 | 535 | RL_SETSTATE(RL_STATE_MOREINPUT); |
527 | | mbchar[mb_len++] = rl_read_key (); |
| 536 | c = rl_read_key (); |
528 | 537 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
529 | 538 | |
| 539 | if (c < 0) |
| 540 | break; |
| 541 | |
| 542 | mbchar[mb_len++] = c; |
| 543 | |
530 | 544 | mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps); |
531 | 545 | if (mbchar_bytes_length == (size_t)(-1)) |
532 | 546 | break; /* invalid byte sequence for the current locale */ |
… |
… |
|
564 | 578 | |
565 | 579 | c = first; |
566 | 580 | memset (mb, 0, mlen); |
567 | | for (i = 0; i < mlen; i++) |
| 581 | for (i = 0; c >= 0 && i < mlen; i++) |
568 | 582 | { |
569 | 583 | mb[i] = (char)c; |
570 | 584 | memset (&ps, 0, sizeof (mbstate_t)); |
diff -Naur readline-5.2.orig/isearch.c readline-5.2/isearch.c
old
|
new
|
|
327 | 327 | rl_command_func_t *f; |
328 | 328 | |
329 | 329 | f = (rl_command_func_t *)NULL; |
330 | | |
331 | | /* Translate the keys we do something with to opcodes. */ |
| 330 | |
| 331 | if (c < 0) |
| 332 | { |
| 333 | cxt->sflags |= SF_FAILED; |
| 334 | cxt->history_pos = cxt->last_found_line; |
| 335 | return -1; |
| 336 | } |
| 337 | |
| 338 | /* Translate the keys we do something with to opcodes. */ |
332 | 339 | if (c >= 0 && _rl_keymap[c].type == ISFUNC) |
333 | 340 | { |
334 | 341 | f = _rl_keymap[c].function; |
diff -Naur readline-5.2.orig/misc.c readline-5.2/misc.c
old
|
new
|
|
146 | 146 | rl_restore_prompt (); |
147 | 147 | rl_clear_message (); |
148 | 148 | RL_UNSETSTATE(RL_STATE_NUMERICARG); |
| 149 | if (key < 0) |
| 150 | return -1; |
149 | 151 | return (_rl_dispatch (key, _rl_keymap)); |
150 | 152 | } |
151 | 153 | } |
diff -Naur readline-5.2.orig/readline.c readline-5.2/readline.c
old
|
new
|
|
645 | 645 | if ((cxt->flags & KSEQ_DISPATCHED) == 0) |
646 | 646 | { |
647 | 647 | nkey = _rl_subseq_getchar (cxt->okey); |
| 648 | if (nkey < 0) |
| 649 | { |
| 650 | _rl_abort_internal (); |
| 651 | return -1; |
| 652 | } |
648 | 653 | r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg); |
649 | 654 | cxt->flags |= KSEQ_DISPATCHED; |
650 | 655 | } |
diff -Naur readline-5.2.orig/support/shobj-conf readline-5.2/support/shobj-conf
old
|
new
|
|
10 | 10 | # Chet Ramey |
11 | 11 | # chet@po.cwru.edu |
12 | 12 | |
13 | | # Copyright (C) 1996-2002 Free Software Foundation, Inc. |
| 13 | # Copyright (C) 1996-2007 Free Software Foundation, Inc. |
14 | 14 | # |
15 | 15 | # This program is free software; you can redistribute it and/or modify |
16 | 16 | # it under the terms of the GNU General Public License as published by |
… |
… |
|
114 | 114 | SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' |
115 | 115 | ;; |
116 | 116 | |
117 | | freebsd2* | netbsd*) |
| 117 | freebsd2*) |
118 | 118 | SHOBJ_CFLAGS=-fpic |
119 | 119 | SHOBJ_LD=ld |
120 | 120 | SHOBJ_LDFLAGS='-x -Bshareable' |
… |
… |
|
125 | 125 | |
126 | 126 | # FreeBSD-3.x ELF |
127 | 127 | freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*) |
128 | | SHOBJ_CFLAGS=-fpic |
| 128 | SHOBJ_CFLAGS=-fPIC |
129 | 129 | SHOBJ_LD='${CC}' |
130 | 130 | |
131 | 131 | if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then |
… |
… |
|
142 | 142 | ;; |
143 | 143 | |
144 | 144 | # Darwin/MacOS X |
145 | | darwin8*) |
| 145 | darwin[89]*) |
146 | 146 | SHOBJ_STATUS=supported |
147 | 147 | SHLIB_STATUS=supported |
148 | 148 | |
… |
… |
|
153 | 153 | SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)' |
154 | 154 | SHLIB_LIBSUFF='dylib' |
155 | 155 | |
156 | | SHOBJ_LDFLAGS='-undefined dynamic_lookup' |
| 156 | SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`' |
157 | 157 | SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' |
158 | 158 | |
159 | 159 | SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1 |
… |
… |
|
171 | 171 | SHLIB_LIBSUFF='dylib' |
172 | 172 | |
173 | 173 | case "${host_os}" in |
174 | | darwin[78]*) SHOBJ_LDFLAGS='' |
| 174 | darwin[789]*) SHOBJ_LDFLAGS='' |
175 | 175 | SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' |
176 | 176 | ;; |
177 | 177 | *) SHOBJ_LDFLAGS='-dynamic' |
… |
… |
|
182 | 182 | SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1 |
183 | 183 | ;; |
184 | 184 | |
185 | | openbsd*) |
| 185 | openbsd*|netbsd*) |
186 | 186 | SHOBJ_CFLAGS=-fPIC |
187 | 187 | SHOBJ_LD='${CC}' |
188 | 188 | SHOBJ_LDFLAGS='-shared' |
… |
… |
|
247 | 247 | SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' |
248 | 248 | ;; |
249 | 249 | |
250 | | aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com |
| 250 | aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com |
251 | 251 | SHOBJ_CFLAGS=-fpic |
252 | 252 | SHOBJ_LD='ld' |
253 | 253 | SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' |
… |
… |
|
258 | 258 | SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' |
259 | 259 | ;; |
260 | 260 | |
261 | | aix4.[2-9]*) |
| 261 | aix4.[2-9]*|aix[5-9].*) |
262 | 262 | SHOBJ_CFLAGS=-K |
263 | 263 | SHOBJ_LD='ld' |
264 | 264 | SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' |
… |
… |
|
329 | 329 | SHOBJ_LD='${CC}' |
330 | 330 | # if you have problems linking here, moving the `-Wl,+h,$@' from |
331 | 331 | # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work |
332 | | SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s' |
| 332 | SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s' |
333 | 333 | |
334 | 334 | SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)' |
335 | 335 | SHLIB_LIBSUFF='sl' |
diff -Naur readline-5.2.orig/text.c readline-5.2/text.c
old
|
new
|
|
857 | 857 | c = rl_read_key (); |
858 | 858 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
859 | 859 | |
| 860 | if (c < 0) |
| 861 | return -1; |
| 862 | |
860 | 863 | #if defined (HANDLE_SIGNALS) |
861 | 864 | if (RL_ISSTATE (RL_STATE_CALLBACK) == 0) |
862 | 865 | _rl_restore_tty_signals (); |
… |
… |
|
1520 | 1523 | |
1521 | 1524 | mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX); |
1522 | 1525 | |
| 1526 | if (mb_len <= 0) |
| 1527 | return -1; |
| 1528 | |
1523 | 1529 | if (count < 0) |
1524 | 1530 | return (_rl_char_search_internal (-count, bdir, mbchar, mb_len)); |
1525 | 1531 | else |
… |
… |
|
1536 | 1542 | c = rl_read_key (); |
1537 | 1543 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
1538 | 1544 | |
| 1545 | if (c < 0) |
| 1546 | return -1; |
| 1547 | |
1539 | 1548 | if (count < 0) |
1540 | 1549 | return (_rl_char_search_internal (-count, bdir, c)); |
1541 | 1550 | else |
diff -Naur readline-5.2.orig/vi_mode.c readline-5.2/vi_mode.c
old
|
new
|
|
886 | 886 | RL_SETSTATE(RL_STATE_MOREINPUT); |
887 | 887 | c = rl_read_key (); |
888 | 888 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 889 | |
| 890 | if (c < 0) |
| 891 | { |
| 892 | *nextkey = 0; |
| 893 | return -1; |
| 894 | } |
| 895 | |
889 | 896 | *nextkey = c; |
890 | 897 | |
891 | 898 | if (!member (c, vi_motion)) |
… |
… |
|
902 | 909 | RL_SETSTATE(RL_STATE_MOREINPUT); |
903 | 910 | c = rl_read_key (); /* real command */ |
904 | 911 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 912 | if (c < 0) |
| 913 | { |
| 914 | *nextkey = 0; |
| 915 | return -1; |
| 916 | } |
905 | 917 | *nextkey = c; |
906 | 918 | } |
907 | 919 | else if (key == c && (key == 'd' || key == 'y' || key == 'c')) |
… |
… |
|
1224 | 1236 | _rl_vi_callback_char_search (data) |
1225 | 1237 | _rl_callback_generic_arg *data; |
1226 | 1238 | { |
| 1239 | int c; |
1227 | 1240 | #if defined (HANDLE_MULTIBYTE) |
1228 | | _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); |
| 1241 | c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); |
1229 | 1242 | #else |
1230 | 1243 | RL_SETSTATE(RL_STATE_MOREINPUT); |
1231 | | _rl_vi_last_search_char = rl_read_key (); |
| 1244 | c = rl_read_key (); |
1232 | 1245 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
1233 | 1246 | #endif |
1234 | 1247 | |
| 1248 | if (c <= 0) |
| 1249 | return -1; |
| 1250 | |
| 1251 | #if !defined (HANDLE_MULTIBYTE) |
| 1252 | _rl_vi_last_search_char = c; |
| 1253 | #endif |
| 1254 | |
1235 | 1255 | _rl_callback_func = 0; |
1236 | 1256 | _rl_want_redisplay = 1; |
1237 | 1257 | |
… |
… |
|
1247 | 1267 | rl_vi_char_search (count, key) |
1248 | 1268 | int count, key; |
1249 | 1269 | { |
| 1270 | int c; |
1250 | 1271 | #if defined (HANDLE_MULTIBYTE) |
1251 | 1272 | static char *target; |
1252 | 1273 | static int tlen; |
… |
… |
|
1293 | 1314 | else |
1294 | 1315 | { |
1295 | 1316 | #if defined (HANDLE_MULTIBYTE) |
1296 | | _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); |
| 1317 | c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); |
| 1318 | if (c <= 0) |
| 1319 | return -1; |
| 1320 | _rl_vi_last_search_mblen = c; |
1297 | 1321 | #else |
1298 | 1322 | RL_SETSTATE(RL_STATE_MOREINPUT); |
1299 | | _rl_vi_last_search_char = rl_read_key (); |
| 1323 | c = rl_read_key (); |
1300 | 1324 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
| 1325 | if (c < 0) |
| 1326 | return -1; |
| 1327 | _rl_vi_last_search_char = c; |
1301 | 1328 | #endif |
1302 | 1329 | } |
1303 | 1330 | } |
… |
… |
|
1467 | 1494 | c = rl_read_key (); |
1468 | 1495 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
1469 | 1496 | |
| 1497 | if (c < 0) |
| 1498 | return -1; |
| 1499 | |
1470 | 1500 | #if defined (HANDLE_MULTIBYTE) |
1471 | 1501 | if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) |
1472 | 1502 | c = _rl_read_mbstring (c, mb, mlen); |
… |
… |
|
1485 | 1515 | |
1486 | 1516 | _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX); |
1487 | 1517 | |
| 1518 | if (c < 0) |
| 1519 | return -1; |
| 1520 | |
1488 | 1521 | _rl_callback_func = 0; |
1489 | 1522 | _rl_want_redisplay = 1; |
1490 | 1523 | |
… |
… |
|
1516 | 1549 | else |
1517 | 1550 | _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX); |
1518 | 1551 | |
| 1552 | if (c < 0) |
| 1553 | return -1; |
| 1554 | |
1519 | 1555 | return (_rl_vi_change_char (count, c, mb)); |
1520 | 1556 | } |
1521 | 1557 | |
… |
… |
|
1650 | 1686 | ch = rl_read_key (); |
1651 | 1687 | RL_UNSETSTATE(RL_STATE_MOREINPUT); |
1652 | 1688 | |
1653 | | if (ch < 'a' || ch > 'z') |
| 1689 | if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */ |
1654 | 1690 | { |
1655 | 1691 | rl_ding (); |
1656 | 1692 | return -1; |
… |
… |
|
1702 | 1738 | rl_point = rl_mark; |
1703 | 1739 | return 0; |
1704 | 1740 | } |
1705 | | else if (ch < 'a' || ch > 'z') |
| 1741 | else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */ |
1706 | 1742 | { |
1707 | 1743 | rl_ding (); |
1708 | 1744 | return -1; |