As I have asked on StackOverflow (http://stackoverflow.com/questions/2818082/how-to-diff-two-regions-of-the-same-file-in-eclipse) there is an open window for a diff tool that can diff regions even in the same file.
Usecase is refactoring out similar code especially if you are using a refactoring tool that can do it automatically. Often the code is not the same initially (unless you just C&P:ed it, and then there are tools that can identify the copies), but you need to see if the sections can be made more similar. Here a good tool to visualize differences are essential. But all diff-tools that I have seen focus on differences between files.
I want a tool that focuses on regions, even inside the same file.
Hi Thomas,
KDiff3 can do this already.
Open the same file on both sides. Then with the mouse select the section of interest in the first view (like for copy and paste), choose menu "Diffview"->"Add manual diff alignment" (Ctrl-Y). Then do this again for the section in the second view. Voila! Both selected regions are now aligned next to each other.
Of course you can also copy some text from your favorite text editor and just paste it either left or right.
Joachim
Excellent! You are welcome to close this feature request ;-)
Is there a way to call that functionality programatically? Shell command args, api, ...?
No. Please specify how you would want to use this. Do you have another tool that would specify the offsets?
Yes, that's right. I was thinking about integrating this with Eclipse or Emacs where I could mark the regions and then call on KDiff3 to do the diffing.
So I'd like to be able to send filename and linenumber for both right and left panes as arguments. I suppose start and end lines would be necessary.
This is still just unimplemented thoughts so no need to rush ;-)