diffuse icon indicating copy to clipboard operation
diffuse copied to clipboard

Wrap lines

Open xlucn opened this issue 3 years ago • 11 comments

It is useful when comparing long lines, such as a long paragraph in natural languages.

xlucn avatar Apr 05 '21 06:04 xlucn

But in fact Diffuse does not wrap lines. I hoped to use Diffuse to compare five versions of textual documents but without the word wrap it's for naught. I cannot see how to enable word wrap with Diffuse. Am I missing something? This is really important for this use case.

johnblommers avatar Apr 19 '21 02:04 johnblommers

@johnblommers I was posting this as a feature request, diffuse indeed does not wrap lines now.

xlucn avatar Apr 19 '21 03:04 xlucn

Word wrap was discussed at the old Sourceforge repository as important but of course that went nowhere. According to the Diffuse roadmap word wrap is planned after release 0.9. That's good to know.

johnblommers avatar Apr 19 '21 04:04 johnblommers

vimdiff + diffchar plugin may be an alternative. I don't know if there are other programs with multi-way comparison and line wrapping.

xlucn avatar Apr 19 '21 05:04 xlucn

Sorry if I'm a bit distant nowadays, I want to and I'll be back on the project at some point but I have higher priorities right now (that said, PRs are always welcome :wink: ).

Apart from that, I agree that line wrapping would be a nice feature (and an important one as a matter of fact).

The roadmap is still the roadmap from the old website. Not saying that I won't follow it, but there might be some technical debts to fix first (upgrading to GTK 3 and Meson, and packaging to a few distros as well as Flatpak are already a good start in this direction).

MightyCreak avatar Apr 19 '21 16:04 MightyCreak

Thanks for weighing in @MightyCreak. From my perch just adding in word wrap would elevate Diffuse head and shoulders above the other tools. Alas I lack the programming skill to add in word wrap so I won't be able to submit a pull request.

johnblommers avatar Apr 19 '21 20:04 johnblommers

I'd help work on this but not too keen on how or where to implement it.  If it's not too much trouble, can anyone summarize what parts of the code should be modified to add this?  I know a bit of the obvious, like there would need to be a checkbox option added to the prefs I suppose, or even just a toggle in the View menu, which triggers a new function toggleWrap() or something, right?  But, where would such a function go and what would it operate on?

Now that I think of it, though, surely others have already done such things, yes?  Part of what's great about open source is no need to reinvent the wheel.  What do we need, Python and GTK3?  Is this helpful/useful at all: https://github.com/esrille/textview-editor/commit/a07d02bcdda2ea88fd8456862ac2b94edc7fb3b4 ?

scarlion1 avatar Jan 07 '24 21:01 scarlion1

It seems that Diffuse is not using a known GTK widget. I think a good entrypoint would be the method FileDiffViewerBase.replaceContents(self, f, ss) (f is an int and it represents the pane index, and ss is a List[str] representing the file contents).

From there, there is an object FileDiffViewerBase.Line which seems to be a good starting point as to how to represent a line of text.

Take that with a grain of salt, I'm still learning the thousands of lines of code of this project :sweat_smile:

MightyCreak avatar Jan 07 '24 22:01 MightyCreak

Actually, have you seen meld?  It has this option. Also it supports themes, which was the other issue here I was gonna look into, but not really needed right now, for me at least...

scarlion1 avatar Jan 08 '24 00:01 scarlion1