diff options
author | Daniel Hahler <git@thequod.de> | 2019-07-23 07:01:12 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-07-24 06:14:12 +0200 |
commit | 733e1a0e7397a25f96f7d27983c69b883280c35e (patch) | |
tree | 3fd4930411de8884f3534715097e6050a71c31d9 /src | |
parent | e134cc9d4a13034401a1323e0515ceb19d43dfea (diff) | |
download | rneovim-733e1a0e7397a25f96f7d27983c69b883280c35e.tar.gz rneovim-733e1a0e7397a25f96f7d27983c69b883280c35e.tar.bz2 rneovim-733e1a0e7397a25f96f7d27983c69b883280c35e.zip |
vim-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 vim/vim#4715)
https://github.com/vim/vim/commit/949f1989cba8bf7653316c2b1444c26f1536bfab
Closes https://github.com/neovim/neovim/pull/10147.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_arglist.vim | 5 | ||||
-rw-r--r-- | src/nvim/version.c | 12 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 6628a74b3c..3efef60f8e 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -122,10 +122,7 @@ func Test_argument() call assert_equal(['d', 'c', 'b', 'a', 'c'], g:buffers) - redir => result - args - redir END - call assert_equal('a b [c] d', trim(result)) + call assert_equal("\na b [c] d ", execute(':args')) .argd call assert_equal(['a', 'b', 'd'], argv()) diff --git a/src/nvim/version.c b/src/nvim/version.c index ee5a12feb0..28bd22dcb3 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -2076,9 +2076,10 @@ void list_in_columns(char_u **items, int size, int current) // Sacrifice it to fit in one more column if possible. int ncol = (int)(Columns + 1) / width; int nrow = item_count / ncol + (item_count % ncol ? 1 : 0); + int cur_row = 1; - // i counts columns then rows. idx counts rows then columns. - for (i = 0; !got_int && i < nrow * ncol; ++i) { + // "i" counts columns then rows. "idx" counts rows then columns. + for (i = 0; !got_int && i < nrow * ncol; i++) { int idx = (i / ncol) + (i % ncol) * nrow; if (idx < item_count) { int last_col = (i + 1) % ncol == 0; @@ -2090,18 +2091,15 @@ void list_in_columns(char_u **items, int size, int current) msg_putchar(']'); } if (last_col) { - if (msg_col > 0) { + if (msg_col > 0 && cur_row < nrow) { msg_putchar('\n'); } + cur_row++; } else { while (msg_col % width) { msg_putchar(' '); } } - } else { - if (msg_col > 0) { - msg_putchar('\n'); - } } } } |