3
if [ $# -eq 3 -a "$2" = '-d' ]; then
5
elif [ $# -ne 1 ]; then
6
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
10
-patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
11
-unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
13
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
18
# DP: bash-3.2 upstream patch bash32-044
26
Bug-Reported-by: slinkp <stuff@slinkp.com>
27
Bug-Reference-ID: <da52a26a-9f38-4861-a918-14d3482b539d@c65g2000hsa.googlegroups.com>
28
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-05/msg00085.html
32
The presence of invisible characters in a prompt longer than the screenwidth
33
with invisible characters on the first and last prompt lines caused readline
34
to place the cursor in the wrong physical location.
38
*** ../bash-3.2-patched/lib/readline/display.c 2007-12-14 21:12:40.000000000 -0500
39
--- lib/readline/display.c 2008-10-23 09:39:46.000000000 -0400
43
OFFSET (which has already been calculated above). */
45
+ #define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
46
+ #define WRAP_OFFSET(line, offset) ((line == 0) \
47
+ ? (offset ? INVIS_FIRST() : 0) \
48
+ : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
49
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
50
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
53
_rl_last_c_pos > wrap_offset &&
54
o_cpos < prompt_last_invisible)
55
! _rl_last_c_pos -= wrap_offset;
57
/* If this is the line with the prompt, we might need to
59
_rl_last_c_pos > wrap_offset &&
60
o_cpos < prompt_last_invisible)
61
! _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
62
! else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
63
! (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
64
! cpos_adjusted == 0 &&
65
! _rl_last_c_pos != o_cpos &&
66
! _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line))
67
! _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line);
69
/* If this is the line with the prompt, we might need to
73
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
74
! int temp, lendiff, wsatend, od, nd, o_cpos;
75
int current_invis_chars;
76
int col_lendiff, col_temp;
79
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
80
! int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
81
int current_invis_chars;
82
int col_lendiff, col_temp;
85
temp = _rl_last_c_pos;
87
! temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
88
if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
89
&& _rl_last_v_pos == current_line - 1)
91
temp = _rl_last_c_pos;
93
! temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
94
if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
95
&& _rl_last_v_pos == current_line - 1)
99
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
101
/* XXX -- this bears closer inspection. Fixes a redisplay bug
102
reported against bash-3.0-alpha by Andreas Schwab involving
103
multibyte characters and prompt strings with invisible
104
characters, but was previously disabled. */
105
! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
107
! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
113
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
114
/* XXX -- this bears closer inspection. Fixes a redisplay bug
115
reported against bash-3.0-alpha by Andreas Schwab involving
116
multibyte characters and prompt strings with invisible
117
characters, but was previously disabled. */
118
! if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
119
! twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
121
! twidth = temp - lendiff;
122
! _rl_last_c_pos += twidth;
127
int cpos, dpos; /* current and desired cursor positions */
129
! woff = W_OFFSET (_rl_last_v_pos, wrap_offset);
130
cpos = _rl_last_c_pos;
131
#if defined (HANDLE_MULTIBYTE)
133
int cpos, dpos; /* current and desired cursor positions */
135
! woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
136
cpos = _rl_last_c_pos;
137
#if defined (HANDLE_MULTIBYTE)
140
prompt string, since they're both buffer indices and DPOS is a
141
desired display position. */
142
! if (new > prompt_last_invisible) /* XXX - don't use woff here */
146
prompt string, since they're both buffer indices and DPOS is a
147
desired display position. */
148
! if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
149
! (prompt_physical_chars > _rl_screenwidth &&
150
! _rl_last_v_pos == prompt_last_screen_line &&
151
! wrap_offset != woff &&
152
! new > (prompt_last_invisible-_rl_screenwidth-wrap_offset)))
155
*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006
156
--- patchlevel.h Mon Oct 16 14:22:54 2006
159
looks for to find the patch level (for the sccs version string). */
161
! #define PATCHLEVEL 43
163
#endif /* _PATCHLEVEL_H_ */
165
looks for to find the patch level (for the sccs version string). */
167
! #define PATCHLEVEL 44
169
#endif /* _PATCHLEVEL_H_ */