Mercurial > vim
comparison src/version.c @ 17478:f9a443306174 v8.1.1737
patch 8.1.1737: :args command that outputs one line gives more prompt
commit https://github.com/vim/vim/commit/949f1989cba8bf7653316c2b1444c26f1536bfab
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jul 23 23:00:08 2019 +0200
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 https://github.com/vim/vim/issues/4715)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 23 Jul 2019 23:15:05 +0200 |
parents | d4b2a212fa2f |
children | 91cac682b09a |
comparison
equal
deleted
inserted
replaced
17477:9b550114e729 | 17478:f9a443306174 |
---|---|
776 }; | 776 }; |
777 | 777 |
778 static int included_patches[] = | 778 static int included_patches[] = |
779 { /* Add new patch number below this line */ | 779 { /* Add new patch number below this line */ |
780 /**/ | 780 /**/ |
781 1737, | |
782 /**/ | |
781 1736, | 783 1736, |
782 /**/ | 784 /**/ |
783 1735, | 785 1735, |
784 /**/ | 786 /**/ |
785 1734, | 787 1734, |
4349 list_in_columns(char_u **items, int size, int current) | 4351 list_in_columns(char_u **items, int size, int current) |
4350 { | 4352 { |
4351 int i; | 4353 int i; |
4352 int ncol; | 4354 int ncol; |
4353 int nrow; | 4355 int nrow; |
4356 int cur_row = 1; | |
4354 int item_count = 0; | 4357 int item_count = 0; |
4355 int width = 0; | 4358 int width = 0; |
4356 #ifdef FEAT_SYN_HL | 4359 #ifdef FEAT_SYN_HL |
4357 int use_highlight = (items == (char_u **)features); | 4360 int use_highlight = (items == (char_u **)features); |
4358 #endif | 4361 #endif |
4379 msg_putchar('\n'); | 4382 msg_putchar('\n'); |
4380 } | 4383 } |
4381 return; | 4384 return; |
4382 } | 4385 } |
4383 | 4386 |
4384 /* The rightmost column doesn't need a separator. | 4387 // The rightmost column doesn't need a separator. |
4385 * Sacrifice it to fit in one more column if possible. */ | 4388 // Sacrifice it to fit in one more column if possible. |
4386 ncol = (int) (Columns + 1) / width; | 4389 ncol = (int) (Columns + 1) / width; |
4387 nrow = item_count / ncol + (item_count % ncol ? 1 : 0); | 4390 nrow = item_count / ncol + (item_count % ncol ? 1 : 0); |
4388 | 4391 |
4389 /* i counts columns then rows. idx counts rows then columns. */ | 4392 // "i" counts columns then rows. idx counts rows then columns. |
4390 for (i = 0; !got_int && i < nrow * ncol; ++i) | 4393 for (i = 0; !got_int && i < nrow * ncol; ++i) |
4391 { | 4394 { |
4392 int idx = (i / ncol) + (i % ncol) * nrow; | 4395 int idx = (i / ncol) + (i % ncol) * nrow; |
4393 | 4396 |
4394 if (idx < item_count) | 4397 if (idx < item_count) |
4405 msg_puts((char *)items[idx]); | 4408 msg_puts((char *)items[idx]); |
4406 if (idx == current) | 4409 if (idx == current) |
4407 msg_putchar(']'); | 4410 msg_putchar(']'); |
4408 if (last_col) | 4411 if (last_col) |
4409 { | 4412 { |
4410 if (msg_col > 0) | 4413 if (msg_col > 0 && cur_row < nrow) |
4411 msg_putchar('\n'); | 4414 msg_putchar('\n'); |
4415 ++cur_row; | |
4412 } | 4416 } |
4413 else | 4417 else |
4414 { | 4418 { |
4415 while (msg_col % width) | 4419 while (msg_col % width) |
4416 msg_putchar(' '); | 4420 msg_putchar(' '); |
4417 } | 4421 } |
4418 } | |
4419 else | |
4420 { | |
4421 if (msg_col > 0) | |
4422 msg_putchar('\n'); | |
4423 } | 4422 } |
4424 } | 4423 } |
4425 } | 4424 } |
4426 | 4425 |
4427 void | 4426 void |