Line Modification System

Some days ago, Dominik implemented a line modification system in the KatePart.
For all who don’t know what that means at all (like me before the DS 2011), here some screenshots.

First, starting with a fresh loaded file:

Now, lets write some lines:

Next, after saving:

Now, lets change some stuff again:

Awesome :)

First I thought: Why to hell do I need such a feature? But after using it some days now, I think it is really VERY useful.

Yesterday I worked in parallel on code that generates integer linear programs as CPLEX files and read the output files (which are > 100000 lines) to find regressions.
I had to manually tweak the ILP files a bit to reveal the reason of my issues and it was just cool to exactly know even after save, which lines in the ILP I touched.
Normally I would have written some comments like \changed… above my modified lines in the output files, but yeah, KatePart does track such stuff now automatically ;)

Even for the much less big source files, it was nice to see:
Oh, I just tweaked that few C++ lines and it did remove the issue, maybe I should look at the lines below/above of that lines, too, for more possible problems?

Therefor: Thanks to Dominik for this nifty feature, I hope others appreciate it, too!

If you want this feature now: Use the guide at kate-editor.org’s Get It!.

12 thoughts on “Line Modification System”

  1. It’s funny how many good features that originally appeared in Microsoft software find their way into open source projects. And people still keep bitching about how much Microsoft sucks. I don’t understand it :)

    -Darkstar

    1. If VS was the first to introduce that, then yes, good idea by Microsoft. I only got it shown in recent Qt Creator versions and never seen it in my VS 2011 here, but guess I just not use it enough to see it :P

  2. What would be cool is if the green could fade (to background) 10% (from original, not from current state) every time you save.
    In that case, to still keep track of what you worked on today, it would have to stop at 10% opacity and stay there for ever.
    An other feature this could have is the ability to highlight the whole line for “not saved” or any level of opacity and higher. Spotting the little bar while scrolling can be hard to with high resolutions.

    An other feature I would like to see is the ability to auto highlight the text block using the code folding thing. So if my cursor is

    void setHeight() {
    if (true) {
    if (true == 1) {

    }
    }
    else {

    }
    }

    Then it would highlight the

    if (true == 1) {

    }

    block with 9% opacity

    if (true) {
    if (true == 1) {

    }
    }

    with 6% opacity and

    void setHeight() {
    if (true) {
    if (true == 1) {

    }
    }
    else {

    }
    }

    with 3% opacity

    Of course, adding a maximal depth would be cool. Ignoring the frontal spaces would be also cool (helt the eye to see the alignment for indentation)

    1. Actually I am not sure that such extensive highlighting of stuff is that productive. I like this simple unsaved changed, saved change much better than more complex: old/new saved (beside one would need to keep history for this instead of simple bits). For the folding highlighting: Same here, not sure if that isn’t to intrusive, perhaps one scope would make sense, but only if it is not too heavy ;) If you want such a feature, please provide some patch, this page contains simple guide to get kate.git and build it ;) Patches welcome.

    2. Well, it would even be easy to implement that, but I’m not so sure about the benefit you’d get out of it. So right now, I’m not planning to do so.
      Implementation Note: each TextLine would need one more uchar (256 values are enough I guess). This value could be increased each time a green line is saved again, to change the color.

      1. The fact is, this feature is “useless” to those saving after every line or so. I can understand with something like fish://, abusive saving is less or more impossible, but having everything green dont help that much. I tried it as soon as I saw the blog post, and its the conclusion that came out of my experiment. Having some kind of history, be it sinple save count or “last 100 modified lines” -> “last 100-200 modified lines” -> “last 200-300 modified lines” and so on, it would kind of be nice.

        By the way, as I am too lazy to report a bug, the “file history” in the tree plugin is broken. It does not save the current file if the icon have changed at some point or somethign like that. It save it only if you select it and do nothing. I dont know if its only me.

        1. > By the way, as I am too lazy to report a bug …

          Are you really telling me that you are too lazy to report a bug, and at the same time request a feature of me, which takes me 2 hours at minimum to implement???

          You said you built Kate yourself. Can you please provide a patch that fixes this issue?

  3. Hi, I like this feature a lot but is there a way to disable it? I just upgraded to Kate 3.8 and I can’t seem to find the option to enable/disable this feature.

    Thanks!

Leave a Reply