pnedev / comparePlus

Compare plugin for Notepad++
GNU General Public License v3.0
993 stars 139 forks source link

Is it possible to save the compare result? #363

Closed byzod closed 1 year ago

byzod commented 1 year ago

I downloaded a mod for a game, the mod support of it is very primal so I have to merge few mods that mod the same file manually

If the game updated (Steam will force update it) and the modded file was changed, bug and crush are expected

So I have to record what I modded, and change respective lines manually base on the updated file after game updates (if any) 1

I have to screenshot the compare result because even it displayed changed lines only but when I selected it, all lines including hidden ones are copied

Is there a way to save my compare result with editable info? Similar to github commit log like this?

I could upload my mod to github and generate such commit log but I'm not sure if it breaks the EULA of the game since it's original files from the game data folder

pnedev commented 1 year ago

Hi @byzod,

I don't fully understand your request.

Unfortunately (because of Scintilla implementation) it is not possible to copy to clipboard only the shown lines - the hidden lines in-between are by default also copied. I can make a separate command to the ComparePlus plugin to do that.

On the other hand I will probably implement a "Generate Patch" ComparePlus command as it is certainly useful (and several people in the past have mentioned already that it will be helpful for their use-cases) so will that solve your problem as well?

BR

byzod commented 1 year ago

Hi @byzod,

I don't fully understand your request.

Unfortunately (because of Scintilla implementation) it is not possible to copy to clipboard only the shown lines - the hidden lines in-between are by default also copied. I can make a separate command to the ComparePlus plugin to do that.

On the other hand I will probably implement a "Generate Patch" ComparePlus command as it is certainly useful (and several people in the past have mentioned already that it will be helpful for their use-cases) so will that solve your problem as well?

BR

I don't quite understand your solution too lol

I mean I want to save the compare result in a format with searchable content

Currently my solution is save both copies of orignal file and modded file, then compare them when I want to check what changed

It works great for my need for now, but I wonder if there could be a better way to implement this feature (sorry but I can't think of a good solution)

What I want is "save the compare result (to a .diff file or something) so you can check the result in that moment, even if the actual file was changed", just like the commit history of github, but without the need to upload (possible) sensitive file

Example, I compare the change of NppHelpers.h and save it (to npphelper-23-feb-6.diff or something), months later the file already changed many times, but I can still check what I change in 2023 feb 6 from "compare result history" file, similar to this

A possible (ugly) solution I can think of is the .diff file simply save the original and new file content, auto compare it when open it, file structure like:

file header

original path of file A

original path of file B

content of file A

content of file B
pnedev commented 1 year ago

OK, I understand now. Well it seems that the "Generate Patch" ComparePlus command I mentioned will fit your needs. Could you please confirm if such patch (diff) file format will solve your problem:

src/NppHelpers.h
@@ -492,10 +492,10 @@ inline intptr_t getUnhiddenLine(int view, intptr_t line)

 inline intptr_t getPreviousUnhiddenLine(int view, intptr_t line)
 {
-    intptr_t visibleLine = CallScintilla(view, SCI_VISIBLEFROMDOCLINE, line, 0) - 1;
+   intptr_t visibleLine = CallScintilla(view, SCI_VISIBLEFROMDOCLINE, line, 0) - 1;

-    if (visibleLine < 0)
-        visibleLine = 0;
+   if (visibleLine < 0)
+       visibleLine = 0;

    return CallScintilla(view, SCI_DOCLINEFROMVISIBLE, visibleLine, 0);
 }

?

byzod commented 1 year ago

OK, I understand now. Well it seems that the "Generate Patch" ComparePlus command I mentioned will fit your needs. Could you please confirm if such patch (diff) file format will solve your problem:

src/NppHelpers.h
@@ -492,10 +492,10 @@ inline intptr_t getUnhiddenLine(int view, intptr_t line)

 inline intptr_t getPreviousUnhiddenLine(int view, intptr_t line)
 {
-    intptr_t visibleLine = CallScintilla(view, SCI_VISIBLEFROMDOCLINE, line, 0) - 1;
+ intptr_t visibleLine = CallScintilla(view, SCI_VISIBLEFROMDOCLINE, line, 0) - 1;

-    if (visibleLine < 0)
-        visibleLine = 0;
+ if (visibleLine < 0)
+     visibleLine = 0;

  return CallScintilla(view, SCI_DOCLINEFROMVISIBLE, visibleLine, 0);
 }

?

Yes, result file like this should work, it can be generated by Git but as I mentioned above, I'm not sure if I can upload game assets to it to generate such thing

As an additional opinion, compareplus is a plugin more focus on visualization and lightweight use for non-expert users, so I prefer visually result (just like what compareplus does now) than this kind of "expert" result. That why I suggest the "auto compare when open" solution

pnedev commented 1 year ago

Yes, result file like this should work, it can be generated by Git but as I mentioned above, I'm not sure if I can upload game assets to it to generate such thing

What I meant is that at some point I might add such function to ComparePlus - to generate a kind of patch after the comparison for future reference (and probably a functionality to apply the patch on some other computer later). It appears that will not be soon though as working on ComparePlus is currently not in my priority list.

About the solution you propose - it is something very custom and not a common use-case so I don't think its implementation is justified, sorry about that. If you manually store both files (as is your current solution) you can do sort-of "auto compare when open" if you use the "Compare from command line" functionality. It is written how you can do that in the latest plugin ReleaseNotes.

BR

byzod commented 1 year ago

Cool, I'll check the command line thing out :D

pnedev commented 1 year ago

This request should be covered when https://github.com/pnedev/comparePlus/issues/188 is implemented so closing it now as a sort of duplicate.

@byzod , Feel free to write here again or open another issue if you have other ideas/requests.

BR