Mercurial > vim
comparison src/popupmnu.c @ 2056:e9e3355861ba v7.2.342
updated for version 7.2.342
Problem: Popup menu displayed wrong in 'rightleft' mode when there are
multi-byte characters.
Solution: Adjust the column computations. (Dominique Pelle)
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Tue, 19 Jan 2010 18:06:03 +0100 |
parents | 734d5bdae499 |
children | 85ad19790706 |
comparison
equal
deleted
inserted
replaced
2055:4aa4510d548c | 2056:e9e3355861ba |
---|---|
343 if (curwin->w_p_rl) | 343 if (curwin->w_p_rl) |
344 { | 344 { |
345 if (st != NULL) | 345 if (st != NULL) |
346 { | 346 { |
347 char_u *rt = reverse_text(st); | 347 char_u *rt = reverse_text(st); |
348 char_u *rt_saved = rt; | |
349 int len, j; | |
350 | 348 |
351 if (rt != NULL) | 349 if (rt != NULL) |
352 { | 350 { |
353 len = (int)STRLEN(rt); | 351 char_u *rt_start = rt; |
354 if (len > pum_width) | 352 int size; |
353 | |
354 size = vim_strsize(rt); | |
355 if (size > pum_width) | |
355 { | 356 { |
356 for (j = pum_width; j < len; ++j) | 357 do |
358 { | |
359 size -= has_mbyte | |
360 ? (*mb_ptr2cells)(rt) : 1; | |
357 mb_ptr_adv(rt); | 361 mb_ptr_adv(rt); |
358 len = pum_width; | 362 } while (size > pum_width); |
363 | |
364 if (size < pum_width) | |
365 { | |
366 /* Most left character requires | |
367 * 2-cells but only 1 cell is | |
368 * available on screen. Put a | |
369 * '<' on the left of the pum | |
370 * item */ | |
371 *(--rt) = '<'; | |
372 size++; | |
373 } | |
359 } | 374 } |
360 screen_puts_len(rt, len, row, | 375 screen_puts_len(rt, (int)STRLEN(rt), |
361 col - len + 1, attr); | 376 row, col - size + 1, attr); |
362 vim_free(rt_saved); | 377 vim_free(rt_start); |
363 } | 378 } |
364 vim_free(st); | 379 vim_free(st); |
365 } | 380 } |
366 col -= width; | 381 col -= width; |
367 } | 382 } |