-
Notifications
You must be signed in to change notification settings - Fork 402
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
Truncate long lines #290
Truncate long lines #290
Conversation
In my experience this default setting makes it inconvenient to use For example, calling
It is not a great for a pager to hide output by default. I think that it would be better if:
|
Hi @gasche, I haven't had too many complaints about this and it was done very early on in the project. The main thing that caused me to do it was minified css and js files on a single line -- delta attempted to syntax highlight them and you can imagine what the performance was like.
You probably know this, but in such repos this problem can be fixed permanently by adding [delta]
max-line-length = 0 to the repo-specific git config (
It seems to me that if these are paragraphs of prose then we can't predict an upper limit
Possibly. But I think that I like diffs not showing entire minified js/css files, with or without syntax highlighting. So, I'm not quite sold personally on the need to change. But I could definitely believe that we could do a better job of letting people working in repos of plain text prose know that they should set |
Non-hard-wrapped text typically uses one line per paragraph, and paragraph tend to not be super-long for readability reasons (and because block structure such as lists, code or math elements require breaking the text paragraph). For To me this suggests that bumping the limit to 1024 or 2048 would be a reasonable choice. In contrast, searching the web for "typical" css file sizes suggests that people aim for CSS files between 10Kio and 25Kio, so the minified CSS one-line files would typically start at around 10,000 characters. (People are generally discouraged from committing their minified CSS files in the version control system, but oh well.) Javascript file sizes are reported to be much larger than that. |
(The |
I got bit by this -- for a few days, I thought there was a bug in
+1, 500 characters seems too low for a default. Also, 8GB of minifed JS takes ~10 seconds to diff (from #154), so there should be room to increase the default before performance becomes a factor.
+1
That purpose seems a bit orthogonal to
I think we should document this in the README, or even better, add the default to the config so it's obvious that this functionality is in play. |
@injust thanks for the extra feedback. Do you have estimates of maximal line lengths for the documents you happen to be working with? (Note: |
The diff that got truncated for me was a uBlock Origin backup, which has very long lines because it converts multi-line strings to JSON. That's not a good example of how I don't have a horse in this race because I immediately set But my take is that if syntax highlighting performance was the motivation behind this functionality, then "How many characters of minified code (which is probably the worst case for performance here?) does it take to cause noticeable performance degradation?" is a good place to start. |
For reference, my uBlock Origin backup file has a max line length of ~12k. It's also a |
When looking at delta performance (a while ago), syntax highlighting was the most expensive part. It might make sense to just limit syntax highlighting and not line length (within reason). In #1746 these are now separated, e.g.
A more complex solution would give delta "syntax fuel", which accumulates over normal lines and and can be spent on one or two overly long lines, but once it runs into a large block only the first 500 characters are highlighted. |
Indeed, I think that #1746 would certainly satisfy my use-case. Thanks! |
While |
Fixes #154, #288