Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max width option #83

Open
waylaidwanderer opened this issue Feb 1, 2023 · 3 comments
Open

Max width option #83

waylaidwanderer opened this issue Feb 1, 2023 · 3 comments
Assignees

Comments

@waylaidwanderer
Copy link

It would be nice to have a max width option as an alternative to a set width.

@PaTTeeL
Copy link

PaTTeeL commented Apr 15, 2023

It would be nice to have a max width option as an alternative to a set width.

Yes, boxen is awesome. I'm using those settings to beautify the text and make them easy to copy and paste.

    options.borderStyle = {
        topLeft: '─',
        topRight: '─',
        bottomLeft: '─',
        bottomRight: '─',
        horizontal: '─',
        vertical: '	',
    }
    options.padding = {
        left: 0,
        right: 0,
    }

It seems that we must define a symbol on both the vertical sides.
Therefore, if I’m using vertical: '' the entire box disappears. I also failed when trying to use padding left: -1 while leaving a space on the vertical side with vertical: ' '.
I would appreciate it if boxen allow no space on the vertical sides of the line.

@Caesarovich
Copy link
Collaborator

Caesarovich commented Apr 22, 2023

@waylaidwanderer What would you say about width could be either a number or a callback function that can determine a width. Like:

options.width = (availableWidth) => {
  return Math.max(30, availableWidth)
}

This could be a way to set a max width of 30.

@waylaidwanderer
Copy link
Author

That looks like a decent flexible solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants