-
Notifications
You must be signed in to change notification settings - Fork 282
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
Allow line breaks in side-by-side view #99
Comments
That is probably the biggest layout problem. For the side-by-side, having only one table, I am not sure if you can make the widths and the overflows work, and even harder to have horizontal scroll working. If you have any suggestions. I can take a look, but this is quite difficult. |
Related to #86 |
@codingtwinky what changes did you make in order to get "word wrap working in default view"? Can you show me an example? |
I have solved this issue in my worspace with some new template files and code changes. I would like to contribute my changes. |
@mohanapreeya that would be nice. Can I check the working version somewhere? |
I have a temporary output in this fork https://github.com/mohanapreeya/diff2html.git. You can view the output in demo page. Source code changes are in the same repository. |
@jung-kim could you tell me how to break word like your image? i don't need make it side by side. |
You mean wordwrap? |
@jung-kim yes, which class should i override |
I'm bit confused on what you mean by "like your image". I presume you mean the green text on the right side and if that is correct break-word is the correct one. |
@jung-kim no, my mean break the work if the sentence too long. |
Green text on the right side is the one with line break isn't it? Either way, pick whatever settings within wordwrap that can help you |
I really need this feature,please |
Not sure if this works in side-by-side but in line-by-line you can get the lines to wrap by changing the following css
|
@robertwalsh0 This CSS does work in side-by-side view as well. |
I cannot replicate this, can you provide a working example? |
New to diff2html. It seems awesome. Thanks for the great work putting it together over the years. Is there currently a working way to have text wrap with any of diff2html's formats? I note that if I use diff2html on a diff, without including the mandatory html resource inputs:
Then the resulting display from this code:
Shows the changes with the text word-wrapped in my app. Of course, it doesn't have the color highlighting that the mandatory html resource inputs have, but I wonder if I can just add that with some css manually. |
No, I could not find a way that does not break something else. |
@rtfpessoa could you point out what were the problems, I did really bad POC but this looks sooo good (not side by side): |
@mensfeld the problem is in the side-by-side diff. Can you make that work for side-by-side too? |
@rtfpessoa I can give it a shot in 1-2 weeks but I'm not an expert and my solution is rather clumsy. |
Thanks for the hint. I got even better results with this as leading whitespace in a line will be preserved:
|
@skivol do you think you could send a full spec with all the changes required to get this to work in both side-by-side and line-by-line? |
@rtfpessoa you mean the full source code of the html template which I used for the purpose (with css styles which were mentioned in the comment above) ? I guess one could try to display both sides in one table (possibly with rowspan for changesets which differ in number of rows) in an attempt to be able to do the wrapping and keep the alignment 🤔 |
Ahh, ok. That not needed |
@rtfpessoa is there an open PR on this? I got it working with some CSS changes. |
👋 @abelpz no, I could never get it working properly. If you got it working in both ways, would be good if we could offer both options (with and without line breaks) maybe by applying a different css classes. |
@rtfpessoa it does work for both side-by-side and line-by-line, I could try to add that if you want, this is what I propose:
If you point me to the files I should look at to add this, I can make a PR. Or I could just share the CSS, and someone else can give it a try. |
I am not sure this can be done with a single file change. The code starts in diff2html.ts. You can test if it works by running |
@abelpz any way you could provide the CSS for defining the table width and word-wrap correctly for Side-by-side diffs? |
I achieved the wrap I needed for side-by-side diffs using the following CSS. Not sure if this breaks line-by-line, but looks like there are solutions for that above.
|
Allow line breaks in side-by-side view to see the code without the need to scroll horizontally.
Check https://github.com/mohanapreeya/diff2html for an example.
Thank for a quick response on #97 and we do have word wrap working in default view but not in side by side view. Wordwrap view has always been challenging in side by side view but I figure I would use this time to describe the problem.
Side by side view with wordwrap is challenging because when word is wrapped in one table, that height needs to be applied to another table. For example, in below right table's words are wrapped and caused increase in row height but it cannot be easily be applied to left table as they are separate table.
Will it be easy to place them in a same table so we can easily do this without JS? I feel like this will not be a trivial change and I think this maybe not be a critical issue.
The text was updated successfully, but these errors were encountered: