aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-05-27 16:25:38 +0900
committererw7 <erw7.github@gmail.com>2019-06-05 09:57:37 +0900
commit68202520c621ec9e58474576272df1456921047f (patch)
tree4118b537bfdb9f791f5ebba03cda4dda67fc6435
parent287fc076e137ea2fac8ac7288fd59eb28c4062cf (diff)
downloadrneovim-68202520c621ec9e58474576272df1456921047f.tar.gz
rneovim-68202520c621ec9e58474576272df1456921047f.tar.bz2
rneovim-68202520c621ec9e58474576272df1456921047f.zip
vim-patch:8.1.1289: may not have enough space to add "W" to search stats
Problem: May not have enough space to add "W" to search stats. Solution: Reserve a bit more space. (Christian Brabandt) https://github.com/vim/vim/commit/b6cb26ffe1795ae62d8235960dccf517c2b2ed45
-rw-r--r--src/nvim/search.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 62e1338496..35875e1cd6 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -1000,6 +1000,7 @@ int do_search(
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.
@@ -1149,8 +1150,8 @@ int do_search(
// 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;
+ if (len < STRLEN(p) + SEARCH_STAT_BUF_LEN + 1) {
+ len = STRLEN(p) + SEARCH_STAT_BUF_LEN + 1;
}
} else {
// Reserve enough space for the search pattern + offset.
@@ -4259,34 +4260,33 @@ static void search_stat(int dirc, pos_T *pos,
}
}
if (cur > 0) {
-#define STAT_BUF_LEN 12
- char t[STAT_BUF_LEN] = "";
+ char t[SEARCH_STAT_BUF_LEN] = "";
int len;
if (curwin->w_p_rl && *curwin->w_p_rlc == 's') {
if (cur == OUT_OF_TIME) {
- vim_snprintf(t, STAT_BUF_LEN, "[?/??]");
+ vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[?/??]");
} else if (cnt > 99 && cur > 99) {
- vim_snprintf(t, STAT_BUF_LEN, "[>99/>99]");
+ vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/>99]");
} else if (cnt > 99) {
- vim_snprintf(t, STAT_BUF_LEN, "[>99/%d]", cur);
+ vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/%d]", cur);
} else {
- vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cnt, cur);
+ vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/%d]", cnt, cur);
}
} else {
if (cur == OUT_OF_TIME) {
- vim_snprintf(t, STAT_BUF_LEN, "[?/??]");
+ vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[?/??]");
} else if (cnt > 99 && cur > 99) {
- vim_snprintf(t, STAT_BUF_LEN, "[>99/>99]");
+ vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[>99/>99]");
} else if (cnt > 99) {
- vim_snprintf(t, STAT_BUF_LEN, "[%d/>99]", cur);
+ vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/>99]", cur);
} else {
- vim_snprintf(t, STAT_BUF_LEN, "[%d/%d]", cur, cnt);
+ vim_snprintf(t, SEARCH_STAT_BUF_LEN, "[%d/%d]", cur, cnt);
}
}
len = STRLEN(t);
- if (show_top_bot_msg && len + 3 < STAT_BUF_LEN) {
+ if (show_top_bot_msg && len + 3 < SEARCH_STAT_BUF_LEN) {
STRCPY(t + len, " W");
len += 2;
}