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

Wrap lines to terminal width #119

Open
brendanzab opened this issue Aug 25, 2019 · 6 comments
Open

Wrap lines to terminal width #119

brendanzab opened this issue Aug 25, 2019 · 6 comments

Comments

@brendanzab
Copy link
Owner

I'm thinking it might be useful to pass in an optional width for line wrapping in the Config struct. This would wrap lines and error messages. If we can figure out how to also include types like those from pretty, then these might be able to take advantage of this information as well.

@ratmice
Copy link
Collaborator

ratmice commented Apr 8, 2020

I ran into something similar, in the json-benchmark there is a 2mb canada.json almost all of of the contents being on a single line.

It might be nice to also have a Config option here for truncating leading strings from long lines, producing something like

 [19389 leading characters omitted] ...
 "foo", "bar", "baz",, 
                     ^ Expected `"String"`, found ","

I'm not sure if it deserved a separate report since it seemed somewhat related.

@jyn514
Copy link
Collaborator

jyn514 commented Apr 8, 2020

I am opposed to this. If you wrap lines to terminal width, then the lines look really ugly whenever the user resizes the terminal. For example, this is what bat does:

   1 # Changelog
   2 
   3 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
   4 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
     .html).

and this is what it looks like when I resize my terminal:

2020-04-08-13:43:07

@ratmice
Copy link
Collaborator

ratmice commented Apr 8, 2020

Just so I understand, you're opposed to this even when locked behind a Config?

@jyn514
Copy link
Collaborator

jyn514 commented Apr 8, 2020

I guess if it's opt-in it would be ok, but it should still be documented that there's no way for codespan to handle terminal resizing. This is a common annoyance that I have with CLI programs, it also breaks copy/pasting.

@brendanzab
Copy link
Owner Author

brendanzab commented Apr 9, 2020

This does seem like something tools should expose, kind of like the coloring of output - something like --wrap-lines auto|never|width=INT. This is an issue for tools like CI that don't really have any terminal width given.

@sophiajt
Copy link

Just to add another vote for this one:

Screenshot from 2020-06-27 15-53-20

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

No branches or pull requests

4 participants