mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
vim-patch:7.4.546
Problem: Repeated use of vim_snprintf() with a number. Solution: Move these vim_snprintf() calls into a function. https://code.google.com/p/vim/source/detail?name=v7-4-546
This commit is contained in:
@@ -233,7 +233,7 @@ static int included_patches[] = {
|
||||
549,
|
||||
//548 NA
|
||||
547,
|
||||
//546,
|
||||
546,
|
||||
545,
|
||||
//544 NA
|
||||
543,
|
||||
|
@@ -124,10 +124,7 @@ do_window (
|
||||
case Ctrl_HAT:
|
||||
case '^':
|
||||
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
||||
STRCPY(cbuf, "split #");
|
||||
if (Prenum)
|
||||
vim_snprintf((char *)cbuf + 7, sizeof(cbuf) - 7,
|
||||
"%" PRId64, (int64_t)Prenum);
|
||||
cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum);
|
||||
do_cmdline_cmd(cbuf);
|
||||
break;
|
||||
|
||||
@@ -151,9 +148,7 @@ newwindow:
|
||||
case Ctrl_Q:
|
||||
case 'q':
|
||||
reset_VIsual_and_resel(); /* stop Visual mode */
|
||||
STRCPY(cbuf, "quit");
|
||||
if (Prenum)
|
||||
vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 5, "%ld", Prenum);
|
||||
cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum);
|
||||
do_cmdline_cmd(cbuf);
|
||||
break;
|
||||
|
||||
@@ -161,9 +156,7 @@ newwindow:
|
||||
case Ctrl_C:
|
||||
case 'c':
|
||||
reset_VIsual_and_resel(); /* stop Visual mode */
|
||||
STRCPY(cbuf, "close");
|
||||
if (Prenum)
|
||||
vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 5, "%ld", Prenum);
|
||||
cmd_with_count("close", cbuf, sizeof(cbuf), Prenum);
|
||||
do_cmdline_cmd(cbuf);
|
||||
break;
|
||||
|
||||
@@ -189,9 +182,7 @@ newwindow:
|
||||
case Ctrl_O:
|
||||
case 'o':
|
||||
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
||||
STRCPY(cbuf, "only");
|
||||
if (Prenum > 0)
|
||||
vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 4, "%ld", Prenum);
|
||||
cmd_with_count("only", cbuf, sizeof(cbuf), Prenum);
|
||||
do_cmdline_cmd(cbuf);
|
||||
break;
|
||||
|
||||
@@ -496,6 +487,16 @@ wingotofile:
|
||||
}
|
||||
}
|
||||
|
||||
static void cmd_with_count(char *cmd, char_u *bufp, size_t bufsize,
|
||||
long Prenum)
|
||||
{
|
||||
size_t len = xstrlcpy((char *)bufp, cmd, bufsize);
|
||||
|
||||
if (Prenum > 0 && len < bufsize) {
|
||||
vim_snprintf((char *)bufp + len, bufsize - len, "%" PRId64, Prenum);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* split the current window, implements CTRL-W s and :split
|
||||
*
|
||||
|
Reference in New Issue
Block a user