mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.1.1737: :args command that outputs one line gives more prompt
Problem: :args command that outputs one line gives more prompt. Solution: Only output line break if needed. (Daniel Hahler, closes #4715)
This commit is contained in:
@@ -140,10 +140,7 @@ func Test_argument()
|
|||||||
|
|
||||||
call assert_equal(['d', 'c', 'b', 'a', 'c'], g:buffers)
|
call assert_equal(['d', 'c', 'b', 'a', 'c'], g:buffers)
|
||||||
|
|
||||||
redir => result
|
call assert_equal("\na b [c] d ", execute(':args'))
|
||||||
args
|
|
||||||
redir END
|
|
||||||
call assert_equal('a b [c] d', trim(result))
|
|
||||||
|
|
||||||
.argd
|
.argd
|
||||||
call assert_equal(['a', 'b', 'd'], argv())
|
call assert_equal(['a', 'b', 'd'], argv())
|
||||||
|
@@ -777,6 +777,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 */
|
||||||
|
/**/
|
||||||
|
1737,
|
||||||
/**/
|
/**/
|
||||||
1736,
|
1736,
|
||||||
/**/
|
/**/
|
||||||
@@ -4351,6 +4353,7 @@ list_in_columns(char_u **items, int size, int current)
|
|||||||
int i;
|
int i;
|
||||||
int ncol;
|
int ncol;
|
||||||
int nrow;
|
int nrow;
|
||||||
|
int cur_row = 1;
|
||||||
int item_count = 0;
|
int item_count = 0;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
@@ -4381,12 +4384,12 @@ list_in_columns(char_u **items, int size, int current)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The rightmost column doesn't need a separator.
|
// The rightmost column doesn't need a separator.
|
||||||
* Sacrifice it to fit in one more column if possible. */
|
// Sacrifice it to fit in one more column if possible.
|
||||||
ncol = (int) (Columns + 1) / width;
|
ncol = (int) (Columns + 1) / width;
|
||||||
nrow = item_count / ncol + (item_count % ncol ? 1 : 0);
|
nrow = item_count / ncol + (item_count % ncol ? 1 : 0);
|
||||||
|
|
||||||
/* i counts columns then rows. idx counts rows then columns. */
|
// "i" counts columns then rows. idx counts rows then columns.
|
||||||
for (i = 0; !got_int && i < nrow * ncol; ++i)
|
for (i = 0; !got_int && i < nrow * ncol; ++i)
|
||||||
{
|
{
|
||||||
int idx = (i / ncol) + (i % ncol) * nrow;
|
int idx = (i / ncol) + (i % ncol) * nrow;
|
||||||
@@ -4407,8 +4410,9 @@ list_in_columns(char_u **items, int size, int current)
|
|||||||
msg_putchar(']');
|
msg_putchar(']');
|
||||||
if (last_col)
|
if (last_col)
|
||||||
{
|
{
|
||||||
if (msg_col > 0)
|
if (msg_col > 0 && cur_row < nrow)
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
|
++cur_row;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4416,11 +4420,6 @@ list_in_columns(char_u **items, int size, int current)
|
|||||||
msg_putchar(' ');
|
msg_putchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (msg_col > 0)
|
|
||||||
msg_putchar('\n');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user