GSoC – View differences for Kate’s swap files


As I stated in a previous post, the swap file feature for Kate is almost done. Back then, the view differences feature wasn’t ready, but now we have a basic implementation of it.
So now, by pressing the “View changes” button, a new KProcess is created, which receives as command line arguments the ‘diff’ program and the two files to be compared. One file is the original file on the disk, and the other one is represented by the recovered data read from the standard input. Then, Kompare launches, and there you can see the differences.
But sadly, at the moment you can’t merge the changes or some of them through Kompare, but I’m working on it. All you can do is see the differences and decide whether you want to recover the lost data or not. Close Kompare, and then press the “Recover” button or the “Discard” one, depending on what you want to do.

3 thoughts on “GSoC – View differences for Kate’s swap files

    1. Yes, kompare can merge files. But there are several things to keep in mind here:
      1. kompare is in kdesdk and not kdelibs. So Kate Part cannot rely on kompare being installed.
      2. communicating with kompare heavily sucks: There is no nice interface where you can simply say merge file 1 and 2 and then get the content.
      In other words: To make it work nicely with kompare, you’d have to work around a lot of issues, which indicate that you are doing something wrong in the design. And we don’t want sucking code in Kate, do we? :-)
      Now honestly: I also would like to have this feature, but as it is right now, it’s not trivial to implement — unfortunately.

  1. yay! :)
    btw, I noticed an interesting thing, I’m not sure if it’s a bug or a feature: if you open a file, change something, and then change it back without pressing undo, kate still thinks you’ve changed the file.

    ..ah, vim also behaves that way. although vim doesn’t keep undo history when it recovers. :)

    the diff is going to be a *very* useful feature – I ended up having to git diff a recovered file yesterday to figure out what I’d changed.

Leave a Reply to Chani Cancel reply

Your email address will not be published. Required fields are marked *

Scroll to top