summaryrefslogtreecommitdiff
path: root/src/popupmnu.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-01-19 18:06:03 +0100
committerBram Moolenaar <Bram@vim.org>2010-01-19 18:06:03 +0100
commitd836bb90ab25a8f78473460ca91d6c13ae7ad2bc (patch)
tree42fa995d7d5f4e04c6ada4f499b9ff41d982d48e /src/popupmnu.c
parente4ebd29ea9218c452b2de3ba1755f4102fdb7cec (diff)
downloadvim-git-d836bb90ab25a8f78473460ca91d6c13ae7ad2bc.tar.gz
updated for version 7.2.342v7.2.342
Problem: Popup menu displayed wrong in 'rightleft' mode when there are multi-byte characters. Solution: Adjust the column computations. (Dominique Pelle)
Diffstat (limited to 'src/popupmnu.c')
-rw-r--r--src/popupmnu.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 5808ae19e..bef9dd5ef 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -345,21 +345,36 @@ pum_redraw()
if (st != NULL)
{
char_u *rt = reverse_text(st);
- char_u *rt_saved = rt;
- int len, j;
if (rt != NULL)
{
- len = (int)STRLEN(rt);
- if (len > pum_width)
+ char_u *rt_start = rt;
+ int size;
+
+ size = vim_strsize(rt);
+ if (size > pum_width)
{
- for (j = pum_width; j < len; ++j)
+ do
+ {
+ size -= has_mbyte
+ ? (*mb_ptr2cells)(rt) : 1;
mb_ptr_adv(rt);
- len = pum_width;
+ } while (size > pum_width);
+
+ if (size < pum_width)
+ {
+ /* Most left character requires
+ * 2-cells but only 1 cell is
+ * available on screen. Put a
+ * '<' on the left of the pum
+ * item */
+ *(--rt) = '<';
+ size++;
+ }
}
- screen_puts_len(rt, len, row,
- col - len + 1, attr);
- vim_free(rt_saved);
+ screen_puts_len(rt, (int)STRLEN(rt),
+ row, col - size + 1, attr);
+ vim_free(rt_start);
}
vim_free(st);
}