File tree Expand file tree Collapse file tree 3 files changed +232
-8
lines changed
testsuite/modules.70-maint Expand file tree Collapse file tree 3 files changed +232
-8
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ Modules 5.3.1 (not yet released)
2323 a requirement and is the sole module to define it. (fix issue #495)
2424* Script: update :command: `pre-commit ` and :command: `commit-msg ` git hook
2525 scripts to use `Hunspell `_ as spell checker instead of Aspell.
26+ * Fix unaligned :subcmd: `list ` output when 100 or more modules are loaded.
27+ (fix issue #496)
2628
2729.. _Hunspell : https://hunspell.github.io/
2830
Original file line number Diff line number Diff line change @@ -1501,27 +1501,28 @@ proc displayElementList {header sgrkey hstyle one_per_line display_idx\
15011501 }
15021502 }
15031503
1504+ # increase index length when 100+ modules to report
1505+ if {$display_idx } {
1506+ set idx_len [ expr {$elt_cnt > 99 ? {3} : {2}}]
1507+ }
1508+
15041509 if {$json } {
15051510 set displist [ join $display_list ,\n ]
15061511 # display one element per line
15071512 } elseif {$one_per_line } {
15081513 if {$display_idx } {
15091514 set idx $start_idx
15101515 foreach elt $display_list {
1511- append displist [ format {%2d ) %s } $idx $elt ] \n
1516+ append displist [ format " % ${idx_len} d ) %s " $idx $elt ] \n
15121517 incr idx
15131518 }
15141519 } else {
15151520 append displist [ join $display_list \n ] \n
15161521 }
15171522 # elsewhere display elements in columns
15181523 } else {
1519- if {$display_idx } {
1520- # save room for numbers and spacing: 2 digits + ) + space
1521- set elt_prefix_len 4
1522- } else {
1523- set elt_prefix_len 0
1524- }
1524+ # save room for numbers and spacing: 2 or 3 digits + ) + space
1525+ set elt_prefix_len [ expr {$display_idx ? $idx_len + 2 : {0}}]
15251526 # save room for two spaces after element
15261527 set elt_suffix_len 2
15271528
@@ -1623,7 +1624,8 @@ proc displayElementList {header sgrkey hstyle one_per_line display_idx\
16231624 set index [ expr {$col * $rows + $row }]
16241625 if {$index < $elt_cnt } {
16251626 if {$display_idx } {
1626- append displist [ format " %2d) " [expr {$index +$start_idx }] ]
1627+ append displist [ format " %${idx_len} d) " [expr {$index +\
1628+ $start_idx }] ]
16271629 }
16281630 # cannot use 'format' as strings may contain SGR codes
16291631 append displist [ lindex $display_list $index ] [ string repeat\
You can’t perform that action at this time.
0 commit comments