Commit 9539638
fetch: refactor calculation of the display table width
When displaying reference updates, we try to print the references in a
neat table. As the table's width is determined its contents we thus need
to precalculate the overall width before we can start printing updated
references.
The calculation is driven by `display_state_init()`, which invokes
`refcol_width()` for every reference that is to be printed. This split
is somewhat confusing. For one, we filter references that shall be
attributed to the overall width in both places. And second, we
needlessly recalculate the maximum line length based on the terminal
columns and display format for every reference.
Refactor the code so that the complete width calculations are neatly
contained in `refcol_width()`.
Signed-off-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent 1c31764 commit 9539638
1 file changed
+34
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
756 | | - | |
| 756 | + | |
757 | 757 | | |
758 | | - | |
| 758 | + | |
| 759 | + | |
759 | 760 | | |
760 | | - | |
761 | | - | |
762 | | - | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
763 | 764 | | |
764 | | - | |
765 | | - | |
| 765 | + | |
| 766 | + | |
766 | 767 | | |
767 | | - | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
768 | 772 | | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
778 | 793 | | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | 794 | | |
783 | | - | |
| 795 | + | |
784 | 796 | | |
785 | 797 | | |
786 | 798 | | |
787 | 799 | | |
788 | 800 | | |
789 | | - | |
790 | 801 | | |
791 | 802 | | |
792 | 803 | | |
| |||
818 | 829 | | |
819 | 830 | | |
820 | 831 | | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
| 832 | + | |
840 | 833 | | |
841 | 834 | | |
842 | 835 | | |
| |||
0 commit comments