]>
Commit | Line | Data |
---|---|---|
f19b3cb6 MT |
1 | READLINE PATCH REPORT |
2 | ===================== | |
3 | ||
4 | Readline-Release: 5.2 | |
5 | Patch-ID: readline52-006 | |
6 | ||
7 | Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru> | |
8 | Bug-Reference-ID: <1178376645.9063.25.camel@localhost> | |
9 | Bug-Reference-URL: http://bugs.gentoo.org/177095 | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | The readline display code miscalculated the screen position when performing | |
14 | a redisplay in which the new text occupies more screen space that the old, | |
15 | but takes fewer bytes to do so (e.g., when replacing a shorter string | |
16 | containing multibyte characters with a longer one containing only ASCII). | |
17 | ||
18 | Patch: | |
19 | ||
20 | *** ../readline-5.2/display.c Thu Apr 26 11:38:22 2007 | |
21 | --- display.c Thu Jul 12 23:10:10 2007 | |
22 | *************** | |
23 | *** 1519,1527 **** | |
24 | /* Non-zero if we're increasing the number of lines. */ | |
25 | int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin; | |
26 | /* Sometimes it is cheaper to print the characters rather than | |
27 | use the terminal's capabilities. If we're growing the number | |
28 | of lines, make sure we actually cause the new line to wrap | |
29 | around on auto-wrapping terminals. */ | |
30 | ! if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) | |
31 | { | |
32 | /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and | |
33 | --- 1568,1596 ---- | |
34 | /* Non-zero if we're increasing the number of lines. */ | |
35 | int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin; | |
36 | + /* If col_lendiff is > 0, implying that the new string takes up more | |
37 | + screen real estate than the old, but lendiff is < 0, meaning that it | |
38 | + takes fewer bytes, we need to just output the characters starting | |
39 | + from the first difference. These will overwrite what is on the | |
40 | + display, so there's no reason to do a smart update. This can really | |
41 | + only happen in a multibyte environment. */ | |
42 | + if (lendiff < 0) | |
43 | + { | |
44 | + _rl_output_some_chars (nfd, temp); | |
45 | + _rl_last_c_pos += _rl_col_width (nfd, 0, temp); | |
46 | + /* If nfd begins before any invisible characters in the prompt, | |
47 | + adjust _rl_last_c_pos to account for wrap_offset and set | |
48 | + cpos_adjusted to let the caller know. */ | |
49 | + if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) | |
50 | + { | |
51 | + _rl_last_c_pos -= wrap_offset; | |
52 | + cpos_adjusted = 1; | |
53 | + } | |
54 | + return; | |
55 | + } | |
56 | /* Sometimes it is cheaper to print the characters rather than | |
57 | use the terminal's capabilities. If we're growing the number | |
58 | of lines, make sure we actually cause the new line to wrap | |
59 | around on auto-wrapping terminals. */ | |
60 | ! else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) | |
61 | { | |
62 | /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and |