]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/readline/readline52-013
Merge branch 'iptables-upnpfw' into core67-merge
[ipfire-2.x.git] / src / patches / readline / readline52-013
1 READLINE PATCH REPORT
2 =====================
3
4 Readline-Release: 5.2
5 Patch-ID: readline52-013
6
7 Bug-Reported-by: slinkp <stuff@slinkp.com>
8 Bug-Reference-ID: <da52a26a-9f38-4861-a918-14d3482b539d@c65g2000hsa.googlegroups.com>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-05/msg00085.html
10
11 Bug-Description:
12
13 The presence of invisible characters in a prompt longer than the screenwidth
14 with invisible characters on the first and last prompt lines caused readline
15 to place the cursor in the wrong physical location.
16
17 Patch:
18
19 *** ../readline-5.2-patched/display.c 2007-12-14 21:12:40.000000000 -0500
20 --- display.c 2008-10-23 09:39:46.000000000 -0400
21 ***************
22 *** 911,914 ****
23 --- 944,951 ----
24 OFFSET (which has already been calculated above). */
25
26 + #define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
27 + #define WRAP_OFFSET(line, offset) ((line == 0) \
28 + ? (offset ? INVIS_FIRST() : 0) \
29 + : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
30 #define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
31 #define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
32 ***************
33 *** 945,949 ****
34 _rl_last_c_pos > wrap_offset &&
35 o_cpos < prompt_last_invisible)
36 ! _rl_last_c_pos -= wrap_offset;
37
38 /* If this is the line with the prompt, we might need to
39 --- 982,992 ----
40 _rl_last_c_pos > wrap_offset &&
41 o_cpos < prompt_last_invisible)
42 ! _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
43 ! else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
44 ! (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
45 ! cpos_adjusted == 0 &&
46 ! _rl_last_c_pos != o_cpos &&
47 ! _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line))
48 ! _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line);
49
50 /* If this is the line with the prompt, we might need to
51 ***************
52 *** 1205,1209 ****
53 {
54 register char *ofd, *ols, *oe, *nfd, *nls, *ne;
55 ! int temp, lendiff, wsatend, od, nd, o_cpos;
56 int current_invis_chars;
57 int col_lendiff, col_temp;
58 --- 1264,1268 ----
59 {
60 register char *ofd, *ols, *oe, *nfd, *nls, *ne;
61 ! int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
62 int current_invis_chars;
63 int col_lendiff, col_temp;
64 ***************
65 *** 1221,1225 ****
66 temp = _rl_last_c_pos;
67 else
68 ! temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
69 if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
70 && _rl_last_v_pos == current_line - 1)
71 --- 1280,1284 ----
72 temp = _rl_last_c_pos;
73 else
74 ! temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
75 if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
76 && _rl_last_v_pos == current_line - 1)
77 ***************
78 *** 1587,1599 ****
79 {
80 _rl_output_some_chars (nfd + lendiff, temp - lendiff);
81 - #if 1
82 /* XXX -- this bears closer inspection. Fixes a redisplay bug
83 reported against bash-3.0-alpha by Andreas Schwab involving
84 multibyte characters and prompt strings with invisible
85 characters, but was previously disabled. */
86 ! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
87 ! #else
88 ! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
89 ! #endif
90 }
91 }
92 --- 1648,1660 ----
93 {
94 _rl_output_some_chars (nfd + lendiff, temp - lendiff);
95 /* XXX -- this bears closer inspection. Fixes a redisplay bug
96 reported against bash-3.0-alpha by Andreas Schwab involving
97 multibyte characters and prompt strings with invisible
98 characters, but was previously disabled. */
99 ! if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
100 ! twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
101 ! else
102 ! twidth = temp - lendiff;
103 ! _rl_last_c_pos += twidth;
104 }
105 }
106 ***************
107 *** 1789,1793 ****
108 int cpos, dpos; /* current and desired cursor positions */
109
110 ! woff = W_OFFSET (_rl_last_v_pos, wrap_offset);
111 cpos = _rl_last_c_pos;
112 #if defined (HANDLE_MULTIBYTE)
113 --- 1850,1854 ----
114 int cpos, dpos; /* current and desired cursor positions */
115
116 ! woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
117 cpos = _rl_last_c_pos;
118 #if defined (HANDLE_MULTIBYTE)
119 ***************
120 *** 1803,1807 ****
121 prompt string, since they're both buffer indices and DPOS is a
122 desired display position. */
123 ! if (new > prompt_last_invisible) /* XXX - don't use woff here */
124 {
125 dpos -= woff;
126 --- 1864,1872 ----
127 prompt string, since they're both buffer indices and DPOS is a
128 desired display position. */
129 ! if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
130 ! (prompt_physical_chars > _rl_screenwidth &&
131 ! _rl_last_v_pos == prompt_last_screen_line &&
132 ! wrap_offset != woff &&
133 ! new > (prompt_last_invisible-_rl_screenwidth-wrap_offset)))
134 {
135 dpos -= woff;