Skip to content

_get_line_fold is not returning the correct number of culumns #74

Description

@robrwo

When I run a command with --help, it wraps at 80 columns.

When I run

perl -MTerm::Size::Any -E 'say  [ Term::Size::Any::chars() ]->[0];'
141

it returns the correct number of columns. Likewise, running the --help with

TEST_FORCE_COLUMN_SIZE=141 

also works correctly. But by default it's not working.

It seems that the eval syntax doesn't work:

sub _get_line_fold {
    my $columns = $ENV{TEST_FORCE_COLUMN_SIZE}
        || eval {
        use_module("Term::Size::Any");
        [ Term::Size::Any::chars() ]->[0];
        } || 80;
 
    return Text::LineFold->new( ColMax => $columns - 4 );
}

Running

perl -MModule::Runtime=use_module \\
   -E 'my $columns =  eval { use_module("Term::Size::Any"); [ Term::Size::Any::chars() ]->[0]; }; say $columns; '

displays nothing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions