mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.1.2325: crash when using balloon with empty line
Problem: Crash when using balloon with empty line. Solution: Handle empty lines. (Markus Braun)
This commit is contained in:
@@ -1209,12 +1209,16 @@ split_message(char_u *mesg, pumitem_T **array)
|
|||||||
int cells;
|
int cells;
|
||||||
|
|
||||||
item = ((balpart_T *)ga.ga_data) + item_idx;
|
item = ((balpart_T *)ga.ga_data) + item_idx;
|
||||||
|
if (item->bytelen == 0)
|
||||||
|
(*array)[line++].pum_text = vim_strsave((char_u *)"");
|
||||||
|
else
|
||||||
for (skip = 0; skip < item->bytelen; skip += thislen)
|
for (skip = 0; skip < item->bytelen; skip += thislen)
|
||||||
{
|
{
|
||||||
if (split_long_items && item->cells >= BALLOON_MIN_WIDTH)
|
if (split_long_items && item->cells >= BALLOON_MIN_WIDTH)
|
||||||
{
|
{
|
||||||
cells = item->indent * 2;
|
cells = item->indent * 2;
|
||||||
for (p = item->start + skip; p < item->start + item->bytelen;
|
for (p = item->start + skip;
|
||||||
|
p < item->start + item->bytelen;
|
||||||
p += mb_ptr2len(p))
|
p += mb_ptr2len(p))
|
||||||
if ((cells += ptr2cells(p)) > BALLOON_MIN_WIDTH)
|
if ((cells += ptr2cells(p)) > BALLOON_MIN_WIDTH)
|
||||||
break;
|
break;
|
||||||
|
@@ -795,6 +795,12 @@ func Test_balloon_split()
|
|||||||
\ ' next = 123}',
|
\ ' next = 123}',
|
||||||
\ ], balloon_split(
|
\ ], balloon_split(
|
||||||
\ 'struct = 0x234 {long = 2343 "\\"some long string that will be wrapped in two\\"", next = 123}'))
|
\ 'struct = 0x234 {long = 2343 "\\"some long string that will be wrapped in two\\"", next = 123}'))
|
||||||
|
call assert_equal([
|
||||||
|
\ 'Some comment',
|
||||||
|
\ '',
|
||||||
|
\ 'typedef this that;',
|
||||||
|
\ ], balloon_split(
|
||||||
|
\ "Some comment\n\ntypedef this that;"))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_popup_position()
|
func Test_popup_position()
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2325,
|
||||||
/**/
|
/**/
|
||||||
2324,
|
2324,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user