READLINE PATCH REPORT ===================== Readline-Release: 8.2 Patch-ID: readline82-013 Bug-Reported-by: Grisha Levit Bug-Reference-ID: TEXT_COUNT_MAX) @@ -860,6 +890,8 @@ _rl_insert_char (int count, int c) xfree (string); incoming_length = 0; stored_count = 0; + + return (pending_bytes_length != 0); #else /* !HANDLE_MULTIBYTE */ char str[TEXT_COUNT_MAX+1]; @@ -873,9 +905,9 @@ _rl_insert_char (int count, int c) rl_insert_text (str); count -= decreaser; } -#endif /* !HANDLE_MULTIBYTE */ return 0; +#endif /* !HANDLE_MULTIBYTE */ } if (MB_CUR_MAX == 1 || rl_byte_oriented) @@ -903,9 +935,11 @@ _rl_insert_char (int count, int c) rl_insert_text (incoming); stored_count = 0; } -#endif - + + return (pending_bytes_length != 0); +#else return 0; +#endif } /* Overwrite the character at point (or next COUNT characters) with C. @@ -983,6 +1017,11 @@ rl_insert (int count, int c) break; } + /* If we didn't insert n and there are pending bytes, we need to insert + them if _rl_insert_char didn't do that on its own. */ + if (r == 1 && rl_insert_mode == RL_IM_INSERT) + r = _rl_insert_char (0, 0); /* flush partial multibyte char */ + if (n != (unsigned short)-2) /* -2 = sentinel value for having inserted N */ { /* setting rl_pending_input inhibits setting rl_last_func so we do it @@ -1054,6 +1093,8 @@ _rl_insert_next_callback (_rl_callback_g int rl_quoted_insert (int count, int key) { + int r; + /* Let's see...should the callback interface futz with signal handling? */ #if defined (HANDLE_SIGNALS) if (RL_ISSTATE (RL_STATE_CALLBACK) == 0) @@ -1072,15 +1113,17 @@ rl_quoted_insert (int count, int key) /* A negative count means to quote the next -COUNT characters. */ if (count < 0) { - int r; - do r = _rl_insert_next (1); while (r == 0 && ++count < 0); - return r; } + else + r = _rl_insert_next (count); - return _rl_insert_next (count); + if (r == 1) + _rl_insert_char (0, 0); /* insert partial multibyte character */ + + return r; } /* Insert a tab character. */