albfan / jmeld

A visual diff and merge tool
44 stars 31 forks source link

Displaying a comparison between a file and it's empty counter part (e.g. new file against non existing) #56

Closed WolfgangFahl closed 2 years ago

WolfgangFahl commented 5 years ago

Currently if an empty file name is passed to jMeld the version control comparison is initiated which seems also to be a bit buggy.

I had error messages when I tried this (which i unfortunately did not record since that is no my usecase).

The user interface is different and things get a bit awkward in my usecase. I'd rather compare to an "empty file".

When creating an empty file with File.createTempFile the name of the file is shown as something like empty80849768099353... and the counterpart is all "red".

I'd rather label one of the files as "empty" and decide that the color scheme should be different in this case since it is not such a big deal if the counter part is completly missing as in the case of a new file that is compared to a non existing file.

How could such a behavior be accomplished with JMeld?

albfan commented 5 years ago

Related code is on org/jmeld/ui/JMeldPanel.java:201

that logic doesn't have much sense, yes.

There new logic could be implemented, what I don't see is what is the purpose on open an empty file against another one.

Is this issue trying to mimic the open blank comparison from meld? I use it a lot, so I'm fine with implement it.

GUI do not allow non existing files to be compared, so let's focus first on CLI where it is avaliable:

About red diff, I think that's ok. From diff perspective, one buffer has content and the other don't, so red shows that content is missing in the other buffer:

captura de pantalla de 2018-09-22 10-37-44

if you have a visual mockup about your ideas please upload, but this to me is ok

albfan commented 2 years ago

Definitely there're two things to fix here:

You should be able to clean file or directory selected (probably allow to edit selected file)

Blank comparison should be fine, one or two should be ok

A plus, three way diff should be supported too

albfan commented 2 years ago

Now is possible to do blank comparison.

Three way still not enabled

Save is not enabled, probably checking if path do not exists it can be enabled, if it is empty I think disabled is correct