+6

Automatically word-wrap very big lines like 1000 characters or more, but not smaller lines like up to 200 characters

Bugged 6 years ago updated by Jared Jeyaretnam 2 years ago 3

The new feature added on https://smartgit.userecho.com/communities/1/topics/3-compare-show-long-left-and-right-line-above-each-other is useful only for lines up to 200 characters, but still ineffective against very long lines line 1000 characters. 

I personally hate the new vertical line panel which show up eating my scarce vertical screen space. So, the first thing I ever do on a new SmartGit installation is to figure out how to disable that feature, which comes enabled by default.

I agree there is no simple solution when diffing very long lines because enabling word wrap will be bad for long lines line 100~200 characters, because the standard space is by standard constrained, then enabling word-wrap will be more awkward/bad: 

Then I would suggest a feature to only wrap lines which are really by like 1000 characters, and keep the usual lines up to 200 characters not wrapped. Because usually lines up to 1000 characters are not code lines but documentation pages like README.md files or Wiki pages, which are edited on text editors with word-wrap enabled. For example, on SmartGit I would see these documentation lines diff changes very bad:

Image 249

While on my text editor, they are nicely displayed with the word wrap:

Image 250


This feature was similarly asked on: 

  1. http://smartgit.3668570.n2.nabble.com/Wrap-Long-Lines-in-Diff-View-td7574045.html
  2. https://smartgit.userecho.com/communities/1/topics/87-changes-view-optionally-wrap-lines

> It's hard to see what changed within a line if it's really long, scrolling is awkward and it's easy to miss a change when doing a review.

The SmartGit team answer was:

> There is no option available to wrap long lines in SmartGit's file compare. You may configure your own file compare which offers this option in the preferences. 

Regarding this, there is this question on StackOverflow about it: https://stackoverflow.com/questions/51756401/use-git-diff-as-diff-algorithm-in-smartgit

It is implicit that feature suggest to wrap all lines at the screen end, this one is about wrapping some lines which are outliers at some limit off the screen.

Wrapping all lines on SmartGit view is not optimal. Would be better only wrap lines which "need" wrapping. For example, assuming our screen can show up to 100 characters without wrapping, and we have some lines with 300 characters, even if 200 characters of them are off the screen, it acceptable a scroll bar for them. 


But for lines up to 1000 characters, where 900 characters are off the screen (in a very long row), a scroll bar for reviewing is useless. Then I would suggest wrapping the lines up to 1000 characters on some limit like 300 characters. Then, for these lines, only 600 characters (1000/300 = 3*300 + 100 -> 3*(300-100) = 600) are off the screen at a time.

here playing with latex too

my suggestio is to go back to stone age with gitgui and set meld as external diff toll

I'm using git and LaTeX together. I tend to write on a one-sentence-per-line basis (it makes changes neat), but then most of my lines go off the screen. It would be fantastic to add supporting for text wrapping, and preferably for short lines too. (It's a stylistic choice, there's no wrong way to view a git diff).