@@ -87,29 +87,41 @@ func displayTableStats(stats *StatsCollector) {
87
87
}
88
88
if repoStat .SkippedCriteria > 0 {
89
89
dnmColor = yellow
90
- }
90
+ }
91
+
92
+ // Construct skipped text without color codes first to get proper width
91
93
mcRaw := fmt .Sprintf ("%d" , repoStat .SkippedMergeConf )
92
94
dnmRaw := fmt .Sprintf ("%d" , repoStat .SkippedCriteria )
93
- skippedRaw := fmt .Sprintf ("%s (MC), %s (DNM)" , mcRaw , dnmRaw )
94
- skippedPadded := fmt .Sprintf ("%-*s" , colWidths [2 ], skippedRaw )
95
- mcIdx := strings .Index (skippedPadded , mcRaw )
96
- dnmIdx := strings .Index (skippedPadded , dnmRaw )
97
- skippedColored := skippedPadded
98
- if mcIdx != - 1 {
99
- skippedColored = skippedColored [:mcIdx ] + colorize (mcRaw , mcColor ) + skippedColored [mcIdx + len (mcRaw ):]
95
+ skippedPlain := fmt .Sprintf ("%s (MC), %s (DNM)" , mcRaw , dnmRaw )
96
+
97
+ // Then add color codes for display
98
+ skippedDisplay := ""
99
+ if noColor {
100
+ skippedDisplay = skippedPlain
101
+ } else {
102
+ mcDisplay := mcColor + mcRaw + reset
103
+ dnmDisplay := dnmColor + dnmRaw + reset
104
+ skippedDisplay = fmt .Sprintf ("%s (MC), %s (DNM)" , mcDisplay , dnmDisplay )
100
105
}
101
- if dnmIdx != - 1 {
102
- dnmIdx = strings .Index (skippedColored , dnmRaw )
103
- skippedColored = skippedColored [:dnmIdx ] + colorize (dnmRaw , dnmColor ) + skippedColored [dnmIdx + len (dnmRaw ):]
106
+
107
+ // Ensure proper padding based on the plaintext width
108
+ paddingLen := colWidths [2 ] - len (skippedPlain )
109
+ padding := ""
110
+ if paddingLen > 0 {
111
+ padding = strings .Repeat (" " , paddingLen )
104
112
}
113
+
105
114
statusColored := colorize (status , statusColor )
106
- statusColored = fmt .Sprintf ("%-*s" , colWidths [3 ]+ len (statusColored )- len (status ), statusColored )
115
+ statusPadding := colWidths [3 ] - len (status )
116
+ if statusPadding > 0 {
117
+ statusColored += strings .Repeat (" " , statusPadding )
118
+ }
107
119
108
120
fmt .Printf (
109
- "│ %-*s │ %s │ %s │ %s │\n " ,
121
+ "│ %-*s │ %*d │ %s %s │ %s │\n " ,
110
122
repoCol , repoStat .RepoName ,
111
- fmt . Sprintf ( "%*d" , colWidths [1 ], repoStat .CombinedCount ) ,
112
- skippedColored ,
123
+ colWidths [1 ], repoStat .CombinedCount ,
124
+ skippedDisplay , padding ,
113
125
statusColored ,
114
126
)
115
127
}
@@ -119,12 +131,39 @@ func displayTableStats(stats *StatsCollector) {
119
131
summaryTop := "╭───────────────┬───────────────┬───────────────────────┬───────────────╮"
120
132
summaryHead := "│ Repos │ Combined PRs │ Skipped │ Total PRs │"
121
133
summarySep := "├───────────────┼───────────────┼───────────────────────┼───────────────┤"
122
- skippedRaw := fmt .Sprintf ("%d (MC), %d (DNM)" , stats .PRsSkippedMergeConflict , stats .PRsSkippedCriteria )
134
+
135
+ // Use the same approach for summary table to ensure consistency
136
+ mcSummaryRaw := fmt .Sprintf ("%d" , stats .PRsSkippedMergeConflict )
137
+ dnmSummaryRaw := fmt .Sprintf ("%d" , stats .PRsSkippedCriteria )
138
+
139
+ skippedSummaryPlain := fmt .Sprintf ("%s (MC), %s (DNM)" , mcSummaryRaw , dnmSummaryRaw )
140
+ skippedSummaryDisplay := skippedSummaryPlain
141
+ if ! noColor {
142
+ mcColor := green
143
+ dnmColor := green
144
+ if stats .PRsSkippedMergeConflict > 0 {
145
+ mcColor = yellow
146
+ }
147
+ if stats .PRsSkippedCriteria > 0 {
148
+ dnmColor = yellow
149
+ }
150
+ mcDisplay := mcColor + mcSummaryRaw + reset
151
+ dnmDisplay := dnmColor + dnmSummaryRaw + reset
152
+ skippedSummaryDisplay = fmt .Sprintf ("%s (MC), %s (DNM)" , mcDisplay , dnmDisplay )
153
+ }
154
+
155
+ summarySkippedPadding := 21 - len (skippedSummaryPlain )
156
+ summaryPadding := ""
157
+ if summarySkippedPadding > 0 {
158
+ summaryPadding = strings .Repeat (" " , summarySkippedPadding )
159
+ }
160
+
123
161
summaryRow := fmt .Sprintf (
124
- "│ %-13d │ %-13d │ %-21s │ %-13d │" ,
162
+ "│ %-13d │ %-13d │ %s%s │ %-13d │" ,
125
163
stats .ReposProcessed ,
126
164
stats .PRsCombined ,
127
- skippedRaw ,
165
+ skippedSummaryDisplay ,
166
+ summaryPadding ,
128
167
len (stats .CombinedPRLinks ),
129
168
)
130
169
summaryBot := "╰───────────────┴───────────────┴───────────────────────┴───────────────╯"
0 commit comments