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

How to turn of line wrapping #19

Open
vjpr opened this issue Jul 22, 2015 · 7 comments
Open

How to turn of line wrapping #19

vjpr opened this issue Jul 22, 2015 · 7 comments

Comments

@vjpr
Copy link

vjpr commented Jul 22, 2015

I couldn't figure out a way to turn of line wrapping.

In CSS it would be white-space: nowrap, but its seems in RenderKid you are setting a terminal width.

My use case is that I am rendering urls which need to be clickable (using CMD + double-click on OSX). For this reason I cannot have line breaks in between urls.

@vjpr
Copy link
Author

vjpr commented Jul 22, 2015

For a start it would be good to be able to pass config to RenderKid - https://github.com/AriaMinaei/pretty-error/blob/master/src/pretty-error.coffee#L39.

EDIT: This did not work. Looks like in Layout there is a config property called width that is set to 80, but cannot be configured anywhere.

@AriaMinaei
Copy link
Owner

Hey @vjpr, thanks for the suggestion. Since it's been a while since you opened this issue (sry for that), I'll wait to see if you still need it fixed. So, let me know.

@adoyle-h
Copy link

+1 for supporting an option to turn off line wrapping.

It displays weird when the error message has too many words.

e.g.

var PrettyError = require('pretty-error');
var pe = new PrettyError();
var renderedError = pe.render(new Error('this is a looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong message'));
console.log(renderedError);

it shows that:

image

@AriaMinaei
Copy link
Owner

@adoyle-h: This was a bug in RenderKid, where it couldn't correctly query the terminal's width, so it would just guess '80'. I've pushed a fix which will land in RenderKid 2.0, and pretty-error 2.0.

@adoyle-h
Copy link

@AriaMinaei Thanks a lot

@jonjaques
Copy link

jonjaques commented Aug 3, 2016

@AriaMinaei This does work, however I have to react into the object to set it. Would be cool if PrettyError constructor took an options hash.

pe._renderer._config.terminalWidth = 9999

@jfmmm
Copy link

jfmmm commented Aug 29, 2018

Another problem is that trying to add color with chalk to an error message will break the terminalWidth.

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

5 participants