diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-05-22 12:50:59 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-05-22 13:00:51 -0400 |
commit | e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72 (patch) | |
tree | 6ff1b06b5d5fd6d3260f3a778c33cfaf03f0c295 /src/nvim/popupmnu.c | |
parent | 0aa8b5828cc0674894681841f40c3c05bfd2f07b (diff) | |
parent | e303a11ebfc352860cce73184ece692ab4d0f01c (diff) | |
download | rneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.tar.gz rneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.tar.bz2 rneovim-e2e47803bdfd5fb40e3dbc9cdf798bb27d306c72.zip |
Merge #708 'Remove NULL/non-NULL tests after vim_str(n)save'
- replace alloc with xmalloc
Diffstat (limited to 'src/nvim/popupmnu.c')
-rw-r--r-- | src/nvim/popupmnu.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 7408ce292b..4c31e9e0ae 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -345,32 +345,27 @@ void pum_redraw(void) *p = saved; if (curwin->w_p_rl) { - char_u *rt = reverse_text(st); - - if (rt != NULL) { - char_u *rt_start = rt; - int size; - - size = vim_strsize(rt); - - if (size > pum_width) { - do { - size -= has_mbyte ? (*mb_ptr2cells)(rt) : 1; - mb_ptr_adv(rt); - } 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++; - } + char_u *rt = reverse_text(st); + char_u *rt_start = rt; + int size = vim_strsize(rt); + + if (size > pum_width) { + do { + size -= has_mbyte ? (*mb_ptr2cells)(rt) : 1; + mb_ptr_adv(rt); + } 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, (int)STRLEN(rt), row, col - size + 1, - attr); - free(rt_start); } + screen_puts_len(rt, (int)STRLEN(rt), row, col - size + 1, + attr); + free(rt_start); free(st); col -= width; |