Sublime Forum

Change Tracker - highlights changes

#1

Hi all,
here is my second plugin (first was Indent XML) for Sublime Text. It’s called ChangeTracker and it highlights changes made in file since last save. Also it allows to navigate through all the changes made.
Here you can watch short (about 1 min) demo - YouTube

Plugin now on github - github.com/alek-sys/ChangeTracker
Hope that it will appear in Package Control soon.

P.S. I see the obvious way for this plugin to grow - highlight not unsaved changes, but uncommited changes (for git / hg / etc) If you have any good ideas or want to take a part in development - you are welcome :smile: Just write here or email me - alexey.nesterov@live.com

0 Likes

Git/scm status in gutter?
What plugins work with ST3?
#2

hmmm… I made same plugin a couple weeks ago (right here). Yours is definitely more elaborate though. If you revert the change, does it unmark the line?

0 Likes

#3

Oops, missed your plugin.
Yes, If revert changes plugin will hide dot / highlight.

0 Likes

#4

hey i like that, nice idea! Will install it and give it a try.

0 Likes

#5

Thanks for sharing.
I tried it but have to uninstall cos it freeze ST when working on lager file (+2MB).

I try to put the diff calculation in a thread and it work fine, but the thread still run forever on large file, so not very useful.
Probably that difflib.SequenceMatcher is way to slow to use it for this kind of task.

This feature must probably be implemented in core to be efficient.

And some other glitch:
-Windows line endings doesn’t work well: you have to use the ‘U’ flag for opening the file to automatically convert line endings:

with open(view.file_name(), "rU") as f: originalText = f.read().decode('utf8')
-It only work for utf-8 file, it will be nice to get the encoding of the view (view.encoding()) and use it to read the file.

I only make quick and dirty change in your source file, so I prefer not showing it :wink:

startup, version: 2144 windows x64 channel: dev

0 Likes

#6

[quote=“bizoo”]Thanks for sharing.
I tried it but have to uninstall cos it freeze ST when working on lager file (+2MB).

startup, version: 2144 windows x64 channel: dev[/quote]

Thanks for all comments, I’ll try to fix asap.

0 Likes

#7

Unfortunately, it doesn’t work (as it probably should do).

v2165 portable, Windows 7 x64 SP1 german.

It was installed correctly (and it shows it’s menu commands under View - Change Tracker) but it doesn’t mark the correct line nor is it able to highlight the correct one or move the cursor to it.

Tried it with different files and different line endings (windows / unix).

An example: The original function

[code]<?php

function create_more_link( $string, $max, $moretext )
{
if ( strlen( $string ) > $max ) {
$max -= strlen( $moretext );
$string = strrev( strstr( strrev( substr( $string, 0, $max ) ), ’ ’ ) );
$link = ‘’ . $moretext . ‘’;
$string .= $link;
}
return $string;
}

$str = ‘It was a dark and stormy night when the Baron prepared his plane.’;

$values = create_more_link( $str, 40, ‘more’ );

echo “

{$values} abc def
”;

?>[/code]

Now I add a new line:

[code]<?php

$val = 2;

function create_more_link( $string, $max, $moretext )
{
if ( strlen( $string ) > $max ) {
$max -= strlen( $moretext );
$string = strrev( strstr( strrev( substr( $string, 0, $max ) ), ’ ’ ) );
$link = ‘’ . $moretext . ‘’;
$string .= $link;
}
return $string;
}

$str = ‘It was a dark and stormy night when the Baron prepared his plane.’;

$values = create_more_link( $str, 40, ‘more’ );

echo “

{$values} abc def
”;

?>[/code]

What I get is: The line with “function create_more_link( $string, $max, $moretext )” is marked with a green dot. Both menu entries (highlight / go to next) don’t do anything (regardless where I position the caret).

Regards,
Highend

0 Likes

#8

This looks like a pretty simple plugin. Does anyone have time to port this to ST3?

0 Likes

#9

This works with ST3 after one small change in changetracker.py at line 51:

#originalText = f.read().decode('utf8') originalText = f.read()
Now to figure out how to change the color of the dot :wink:

0 Likes

#10

Anyone figure out how to set the color of this dot?
Very cool tool, but the dot is not very noticeable and looks like the bookmark that is used in codeblocks so is confusing my brain!
But much better than not seeing what lines I’ve changed!

0 Likes