Bug#282850: Patch: Added option to increase label width
Hello,
i changed behavior from label width as a constant to changeable
with command line option --width <nn> or -w <nn>.
This perhaps fixes this bug.
Yours
Thomas
--- /usr/sbin/sysv-rc-conf 2012-05-09 12:21:50.000000000 +0200
+++ sysv-rc-conf 2018-05-02 10:20:58.973408688 +0200
@@ -31,7 +31,6 @@
BOTTOM_WIN_HEIGHT => 4,
DEFAULT_K_PRI => 80,
DEFAULT_S_PRI => 20,
- LABEL_WIDTH => 10,
LIST_SN_LENGTH => 12,
LIST_SN_PAD => 1,
MAX_ROWS => 8,
@@ -52,6 +51,7 @@
chkcfg_list => undef,
chkcfg_sn => '',
chkcfg_state => '',
+ label_width => 10,
);
GetOptions("cache=s" => \$opts{cache_dir},
@@ -65,6 +65,7 @@
"show=s" => \$opts{show},
"verbose=s" => \$opts{verbose},
"Version" => sub { print STDERR "$0 $VERSION\n"; exit; },
+ "width=i" => \$opts{label_width},
) or exit(1);
my $runlevel_cmd = '/sbin/runlevel';
@@ -712,7 +713,7 @@
undef, 'Label',
-text => $left_label,
-y => $row,
- -width => LABEL_WIDTH,
+ -width => $opts{label_width},
-height => last_x() + 1,
);
@@ -791,7 +792,7 @@
{
my ($screen, $sn, $row) = @_;
- for (my $i = 0, my $right_n = 12; $i <= $#show_rls; $i++, $right_n += 8) {
+ for (my $i = 0, my $right_n = $opts{label_width} + 2; $i <= $#show_rls; $i++, $right_n += 8) {
my $on_or_off = 0;
my $initial_state = 0;
# We only want to show S\d\d services as selected.
@@ -830,7 +831,7 @@
{
my ($screen, $sn, $row) = @_;
- for (my $i = 0, my $right_n = 11; $i <= $#show_rls; $i++, $right_n += 8) {
+ for (my $i = 0, my $right_n = $opts{label_width} + 1; $i <= $#show_rls; $i++, $right_n += 8) {
my $text = exists $runlevels{$sn}{$show_rls[$i]}
? $runlevels{$sn}{$show_rls[$i]}
: '';
@@ -867,10 +868,10 @@
my @label_rls = @show_rls;
- my $text = 'service ' . shift @label_rls;
+ my $text = 'service' . ' ' x ($opts{label_width} - 4) . shift @label_rls;
foreach (@label_rls) { $text .= " $_" };
$text .= "\n";
- $text .= "-" x 76;
+ $text .= "-" x ($opts{label_width} + 2 + scalar(@show_rls) * 8);
$window->add(
undef, 'Label',
Reply to: