comparison src/version.c @ 17524:2b35e273392b v8.1.1760

patch 8.1.1760: extra line break for wrapping output of :args commit https://github.com/vim/vim/commit/9800bfe0fc7596e8fee97172139f0777bac639fb Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 27 21:23:45 2019 +0200 patch 8.1.1760: extra line break for wrapping output of :args Problem: Extra line break for wrapping output of :args. Solution: Avoid the extra line break. (Daniel Hahler, closes https://github.com/vim/vim/issues/4737)
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Jul 2019 21:30:05 +0200
parents e17cbc3e545d
children ae379e753465
comparison
equal deleted inserted replaced
17523:80252a3e2550 17524:2b35e273392b
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 1760,
782 /**/
781 1759, 783 1759,
782 /**/ 784 /**/
783 1758, 785 1758,
784 /**/ 786 /**/
785 1757, 787 1757,
4416 } 4418 }
4417 width += 1; 4419 width += 1;
4418 4420
4419 if (Columns < width) 4421 if (Columns < width)
4420 { 4422 {
4421 /* Not enough screen columns - show one per line */ 4423 // Not enough screen columns - show one per line
4422 for (i = 0; i < item_count; ++i) 4424 for (i = 0; i < item_count; ++i)
4423 { 4425 {
4424 version_msg_wrap(items[i], i == current); 4426 version_msg_wrap(items[i], i == current);
4425 if (msg_col > 0) 4427 if (msg_col > 0 && i < item_count - 1)
4426 msg_putchar('\n'); 4428 msg_putchar('\n');
4427 } 4429 }
4428 return; 4430 return;
4429 } 4431 }
4430 4432
4431 // The rightmost column doesn't need a separator. 4433 // The rightmost column doesn't need a separator.
4432 // Sacrifice it to fit in one more column if possible. 4434 // Sacrifice it to fit in one more column if possible.
4433 ncol = (int) (Columns + 1) / width; 4435 ncol = (int) (Columns + 1) / width;
4434 nrow = item_count / ncol + (item_count % ncol ? 1 : 0); 4436 nrow = item_count / ncol + (item_count % ncol ? 1 : 0);
4435 4437
4436 // "i" counts columns then rows. idx counts rows then columns. 4438 // "i" counts columns then rows. "idx" counts rows then columns.
4437 for (i = 0; !got_int && i < nrow * ncol; ++i) 4439 for (i = 0; !got_int && i < nrow * ncol; ++i)
4438 { 4440 {
4439 int idx = (i / ncol) + (i % ncol) * nrow; 4441 int idx = (i / ncol) + (i % ncol) * nrow;
4440 4442
4441 if (idx < item_count) 4443 if (idx < item_count)
4465 } 4467 }
4466 } 4468 }
4467 else 4469 else
4468 { 4470 {
4469 // this row is out of items, thus at the end of the row 4471 // this row is out of items, thus at the end of the row
4470 if (msg_col > 0 && cur_row < nrow) 4472 if (msg_col > 0)
4471 msg_putchar('\n'); 4473 {
4472 ++cur_row; 4474 if (cur_row < nrow)
4475 msg_putchar('\n');
4476 ++cur_row;
4477 }
4473 } 4478 }
4474 } 4479 }
4475 } 4480 }
4476 4481
4477 void 4482 void