summaryrefslogtreecommitdiff
path: root/cmd-line-utils/readline/display.c
diff options
context:
space:
mode:
authorStaale Smedseng <staale.smedseng@sun.com>2009-06-29 15:17:01 +0200
committerStaale Smedseng <staale.smedseng@sun.com>2009-06-29 15:17:01 +0200
commit67771508836edda4bad393f1a00d89cd419e3814 (patch)
treec3d2d1b1efe2de7e702c3d65d8b7bddccbdbd5d0 /cmd-line-utils/readline/display.c
parent729648c4b776ec4992f6333f0c70b4b749e8d996 (diff)
downloadmariadb-git-67771508836edda4bad393f1a00d89cd419e3814.tar.gz
Merge from 5.0-bt
Diffstat (limited to 'cmd-line-utils/readline/display.c')
-rw-r--r--cmd-line-utils/readline/display.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/cmd-line-utils/readline/display.c b/cmd-line-utils/readline/display.c
index 842a586b76b..fa5b67a8e69 100644
--- a/cmd-line-utils/readline/display.c
+++ b/cmd-line-utils/readline/display.c
@@ -127,7 +127,7 @@ int _rl_want_redisplay = 0;
/* The stuff that gets printed out before the actual text of the line.
This is usually pointing to rl_prompt. */
-char *rl_display_prompt = (char *)NULL;
+const char *rl_display_prompt = (const char *)NULL;
/* Pseudo-global variables declared here. */
@@ -229,7 +229,10 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
int *lp, *lip, *niflp, *vlp;
{
char *r, *ret, *p, *igstart;
- int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
+ int l, rl, last, ignoring, ninvis, invfl, invflset, physchars;
+#if defined (HANDLE_MULTIBYTE)
+ int ind, pind;
+#endif
/* Short-circuit if we can. */
if ((MB_CUR_MAX <= 1 || rl_byte_oriented) && strchr (pmt, RL_PROMPT_START_IGNORE) == 0)
@@ -242,7 +245,7 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
if (niflp)
*niflp = 0;
if (vlp)
- *vlp = lp ? *lp : strlen (r);
+ *vlp = lp ? *lp : (int)strlen (r);
return r;
}
@@ -459,9 +462,10 @@ rl_redisplay ()
register int in, out, c, linenum, cursor_linenum;
register char *line;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
- int newlines, lpos, temp, modmark, n0, num;
- char *prompt_this_line;
+ int newlines, lpos, temp, modmark;
+ const char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
+ int num, n0;
wchar_t wc;
size_t wc_bytes;
int wc_width;
@@ -626,7 +630,6 @@ rl_redisplay ()
contents of the command line? */
while (lpos >= _rl_screenwidth)
{
- int z;
/* fix from Darin Johnson <darin@acuson.com> for prompt string with
invisible characters that is longer than the screen width. The
prompt_invis_chars_first_line variable could be made into an array
@@ -635,6 +638,7 @@ rl_redisplay ()
prompts that exceed two physical lines?
Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
#if defined (HANDLE_MULTIBYTE)
+ int z;
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
n0 = num;
@@ -878,6 +882,7 @@ rl_redisplay ()
if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up)
{
int nleft, pos, changed_screen_line, tx;
+ char empty_str[1] = { 0 };
if (!rl_display_fixed || forced_display)
{
@@ -902,7 +907,7 @@ rl_redisplay ()
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
#define VIS_CHARS(line) (visible_line + vis_lbreaks[line])
-#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line)
+#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? empty_str : VIS_CHARS(line)
#define INV_LINE(line) (invisible_line + inv_lbreaks[line])
/* For each line in the buffer, do the updating display. */
@@ -969,7 +974,7 @@ rl_redisplay ()
_rl_move_vert (linenum);
_rl_move_cursor_relative (0, tt);
_rl_clear_to_eol
- ((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth);
+ ((linenum == _rl_vis_botlin) ? (int)strlen (tt) : _rl_screenwidth);
}
}
_rl_vis_botlin = inv_botlin;
@@ -2261,7 +2266,7 @@ static void
redraw_prompt (t)
char *t;
{
- char *oldp;
+ const char *oldp;
oldp = rl_display_prompt;
rl_save_prompt ();