5 Patch-ID: readline52-005
7 Bug-Reported-by: Thomas Loeber <ifp@loeber1.de>
8 Bug-Reference-ID: <200703082223.08919.ifp@loeber1.de>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-03/msg00036.html
13 When rl_read_key returns -1, indicating that readline's controlling terminal
14 has been invalidated for some reason (e.g., receiving a SIGHUP), the error
15 status was not reported correctly to the caller. This could cause input
20 *** ../readline-5.2/complete.c Fri Jul 28 11:35:49 2006
21 --- complete.c Tue Mar 13 08:50:16 2007
24 if (c == 'n' || c == 'N' || c == RUBOUT)
26 ! if (c == ABORT_CHAR)
27 _rl_abort_internal ();
28 if (for_pager && (c == NEWLINE || c == RETURN))
30 if (c == 'n' || c == 'N' || c == RUBOUT)
32 ! if (c == ABORT_CHAR || c < 0)
33 _rl_abort_internal ();
34 if (for_pager && (c == NEWLINE || c == RETURN))
35 *** ../readline-5.2/input.c Wed Aug 16 15:15:16 2006
36 --- input.c Wed May 2 16:07:59 2007
42 size_t mbchar_bytes_length;
48 size_t mbchar_bytes_length;
52 memset(&ps, 0, sizeof (mbstate_t));
53 memset(&ps_back, 0, sizeof (mbstate_t));
57 RL_SETSTATE(RL_STATE_MOREINPUT);
58 ! mbchar[mb_len++] = rl_read_key ();
59 RL_UNSETSTATE(RL_STATE_MOREINPUT);
61 mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
62 if (mbchar_bytes_length == (size_t)(-1))
64 memset(&ps, 0, sizeof (mbstate_t));
65 memset(&ps_back, 0, sizeof (mbstate_t));
70 RL_SETSTATE(RL_STATE_MOREINPUT);
72 RL_UNSETSTATE(RL_STATE_MOREINPUT);
77 + mbchar[mb_len++] = c;
79 mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
80 if (mbchar_bytes_length == (size_t)(-1))
85 ! for (i = 0; i < mlen; i++)
91 ! for (i = 0; c >= 0 && i < mlen; i++)
94 *** ../readline-5.2/isearch.c Mon Dec 26 17:18:53 2005
95 --- isearch.c Fri Mar 9 14:30:59 2007
99 f = (rl_command_func_t *)NULL;
101 ! /* Translate the keys we do something with to opcodes. */
102 if (c >= 0 && _rl_keymap[c].type == ISFUNC)
106 f = (rl_command_func_t *)NULL;
110 ! cxt->sflags |= SF_FAILED;
111 ! cxt->history_pos = cxt->last_found_line;
115 ! /* Translate the keys we do something with to opcodes. */
116 if (c >= 0 && _rl_keymap[c].type == ISFUNC)
118 *** ../readline-5.2/misc.c Mon Dec 26 17:20:46 2005
119 --- misc.c Fri Mar 9 14:44:11 2007
124 RL_UNSETSTATE(RL_STATE_NUMERICARG);
127 return (_rl_dispatch (key, _rl_keymap));
129 *** ../readline-5.2/readline.c Wed Aug 16 15:00:36 2006
130 --- readline.c Fri Mar 9 14:47:24 2007
135 nkey = _rl_subseq_getchar (cxt->okey);
138 + _rl_abort_internal ();
141 r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
142 cxt->flags |= KSEQ_DISPATCHED;
143 *** ../readline-5.2/text.c Fri Jul 28 11:55:27 2006
144 --- text.c Sun Mar 25 13:41:38 2007
148 RL_UNSETSTATE(RL_STATE_MOREINPUT);
153 #if defined (HANDLE_SIGNALS)
154 if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
158 mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
164 return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
168 RL_UNSETSTATE(RL_STATE_MOREINPUT);
174 return (_rl_char_search_internal (-count, bdir, c));
175 *** ../readline-5.2/vi_mode.c Sat Jul 29 16:42:28 2006
176 --- vi_mode.c Fri Mar 9 15:02:11 2007
181 RL_UNSETSTATE(RL_STATE_MOREINPUT);
194 c = rl_read_key (); /* real command */
195 RL_UNSETSTATE(RL_STATE_MOREINPUT);
205 _rl_callback_generic_arg *data;
207 #if defined (HANDLE_MULTIBYTE)
208 ! _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
210 RL_SETSTATE(RL_STATE_MOREINPUT);
211 ! _rl_vi_last_search_char = rl_read_key ();
212 RL_UNSETSTATE(RL_STATE_MOREINPUT);
215 _rl_callback_func = 0;
216 _rl_want_redisplay = 1;
218 _rl_callback_generic_arg *data;
221 #if defined (HANDLE_MULTIBYTE)
222 ! c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
224 RL_SETSTATE(RL_STATE_MOREINPUT);
225 ! c = rl_read_key ();
226 RL_UNSETSTATE(RL_STATE_MOREINPUT);
232 + #if !defined (HANDLE_MULTIBYTE)
233 + _rl_vi_last_search_char = c;
236 _rl_callback_func = 0;
237 _rl_want_redisplay = 1;
244 #if defined (HANDLE_MULTIBYTE)
249 #if defined (HANDLE_MULTIBYTE)
250 ! _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
252 RL_SETSTATE(RL_STATE_MOREINPUT);
253 ! _rl_vi_last_search_char = rl_read_key ();
254 RL_UNSETSTATE(RL_STATE_MOREINPUT);
259 #if defined (HANDLE_MULTIBYTE)
260 ! c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
263 ! _rl_vi_last_search_mblen = c;
265 RL_SETSTATE(RL_STATE_MOREINPUT);
266 ! c = rl_read_key ();
267 RL_UNSETSTATE(RL_STATE_MOREINPUT);
270 + _rl_vi_last_search_char = c;
276 RL_UNSETSTATE(RL_STATE_MOREINPUT);
281 #if defined (HANDLE_MULTIBYTE)
282 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
286 _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
291 _rl_callback_func = 0;
292 _rl_want_redisplay = 1;
296 _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
301 return (_rl_vi_change_char (count, c, mb));
305 RL_UNSETSTATE(RL_STATE_MOREINPUT);
307 ! if (ch < 'a' || ch > 'z')
311 RL_UNSETSTATE(RL_STATE_MOREINPUT);
313 ! if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
320 ! else if (ch < 'a' || ch > 'z')
326 ! else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */