Patch 8.1.1289

7 views
Skip to first unread message

Bram Moolenaar

unread,
May 7, 2019, 3:35:01 PM5/7/19
to vim...@googlegroups.com

Patch 8.1.1289
Problem: May not have enough space to add "W" to search stats.
Solution: Reserve a bit more space. (Christian Brabandt)
Files: src/search.c


*** ../vim-8.1.1288/src/search.c 2019-05-07 21:29:08.427331900 +0200
--- src/search.c 2019-05-07 21:32:31.546229160 +0200
***************
*** 1219,1224 ****
--- 1219,1225 ----
char_u *ps;
char_u *msgbuf = NULL;
size_t len;
+ #define SEARCH_STAT_BUF_LEN 12

/*
* A line offset is not remembered, this is vi compatible.
***************
*** 1399,1406 ****
else
// Use up to 'showcmd' column.
len = (int)(Rows - msg_row - 1) * Columns + sc_col - 1;
! if (len < STRLEN(p) + 40 + 11)
! len = STRLEN(p) + 40 + 11;
}
else
// Reserve enough space for the search pattern + offset.
--- 1400,1407 ----
else
// Use up to 'showcmd' column.
len = (int)(Rows - msg_row - 1) * Columns + sc_col - 1;
! if (len < STRLEN(p) + 40 + SEARCH_STAT_BUF_LEN + 1)
! len = STRLEN(p) + 40 + SEARCH_STAT_BUF_LEN + 1;
}
else
// Reserve enough space for the search pattern + offset.
***************
*** 4982,5018 ****
}
if (cur > 0)
{
! #define STAT_BUF_LEN 12
! char t[STAT_BUF_LEN] = "";
int len;

#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl && *curwin->w_p_rlc == 's')
{
if (cur == OUT_OF_TIME)
! vim_snprintf(t, STAT_BUF_LEN, "[?/??]");
else if (cnt > 99 && cur > 99)
! vim_snprintf(t, STAT_BUF_LEN, "[>99/>99]");
else if (cnt > 99)
! vim_snprintf(t, STAT_BUF_LEN, "[>99/%d]", cur);
else
! vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cnt, cur);
}
else
#endif
{
if (cur == OUT_OF_TIME)
! vim_snprintf(t, STAT_BUF_LEN, "[?/??]");
else if (cnt > 99 && cur > 99)
! vim_snprintf(t, STAT_BUF_LEN, "[>99/>99]");
else if (cnt > 99)
! vim_snprintf(t, STAT_BUF_LEN, "[%d/>99]", cur);
else
! vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt);
}

len = STRLEN(t);
! if (show_top_bot_msg && len + 3 < STAT_BUF_LEN)
{
STRCPY(t + len, " W");
len += 2;
--- 4983,5018 ----
}
if (cur > 0)
{
! char t[SEARCH_STAT_BUF_LEN] = "";
int len;

#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl && *curwin->w_p_rlc == 's')
{
if (cur == OUT_OF_TIME)
! vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[?/??]");
else if (cnt > 99 && cur > 99)
! vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/>99]");
else if (cnt > 99)
! vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/%d]", cur);
else
! vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/%d]", cnt, cur);
}
else
#endif
{
if (cur == OUT_OF_TIME)
! vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[?/??]");
else if (cnt > 99 && cur > 99)
! vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/>99]");
else if (cnt > 99)
! vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/>99]", cur);
else
! vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/%d]", cur, cnt);
}

len = STRLEN(t);
! if (show_top_bot_msg && len + 3 < SEARCH_STAT_BUF_LEN)
{
STRCPY(t + len, " W");
len += 2;
*** ../vim-8.1.1288/src/version.c 2019-05-07 21:29:08.427331900 +0200
--- src/version.c 2019-05-07 21:33:53.253784068 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1289,
/**/

--
Beer & pretzels can't be served at the same time in any bar or restaurant.
[real standing law in North Dakota, United States of America]

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages