Home Download Buy Blog Forum Support

Change Tracker - highlights changes

Change Tracker - highlights changes

Postby alek_sys on Sun Dec 04, 2011 6:41 pm

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 - https://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 :) Just write here or email me - alexey.nesterov@live.com
alek_sys
 
Posts: 7
Joined: Thu Nov 17, 2011 3:22 pm

Re: Change Tracker - highlights changes

Postby C0D312 on Sun Dec 04, 2011 6:58 pm

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?
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Change Tracker - highlights changes

Postby alek_sys on Sun Dec 04, 2011 7:20 pm

C0D312 wrote: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?


Oops, missed your plugin.
Yes, If revert changes plugin will hide dot / highlight.
alek_sys
 
Posts: 7
Joined: Thu Nov 17, 2011 3:22 pm

Re: Change Tracker - highlights changes

Postby eikaramba on Sun Dec 04, 2011 11:36 pm

hey i like that, nice idea! Will install it and give it a try.
eikaramba
 
Posts: 21
Joined: Thu Mar 10, 2011 1:06 am

Re: Change Tracker - highlights changes

Postby bizoo on Tue Dec 06, 2011 7:50 am

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:
Code: Select all
            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 ;)

startup, version: 2144 windows x64 channel: dev
bizoo
 
Posts: 883
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Change Tracker - highlights changes

Postby alek_sys on Tue Dec 06, 2011 8:26 am

bizoo wrote: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


Thanks for all comments, I'll try to fix asap.
alek_sys
 
Posts: 7
Joined: Thu Nov 17, 2011 3:22 pm

Re: Change Tracker - highlights changes

Postby highend on Wed Jan 25, 2012 10:22 am

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: Select all
<?php

function create_more_link( $string, $max, $moretext )
{
   if ( strlen( $string ) > $max ) {
      $max -= strlen( $moretext );
      $string = strrev( strstr( strrev( substr( $string, 0, $max ) ), ' ' ) );
      $link = '<a href="../">' . $moretext . '</a>';
      $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 "<pre>{$values} abc def</pre>";

?>


Now I add a new line:
Code: Select all
<?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 = '<a href="../">' . $moretext . '</a>';
      $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 "<pre>{$values} abc def</pre>";

?>


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
highend
 
Posts: 94
Joined: Fri Jan 20, 2012 2:47 pm

Re: Change Tracker - highlights changes

Postby Grant on Wed Feb 06, 2013 6:49 pm

This looks like a pretty simple plugin. Does anyone have time to port this to ST3?
Grant
 
Posts: 68
Joined: Fri Jan 20, 2012 2:42 pm

Re: Change Tracker - highlights changes

Postby Grant on Thu Feb 07, 2013 1:42 pm

This works with ST3 after one small change in changetracker.py at line 51:
Code: Select all
                #originalText = f.read().decode('utf8')
                originalText = f.read()

Now to figure out how to change the color of the dot ;)
Grant
 
Posts: 68
Joined: Fri Jan 20, 2012 2:42 pm

Re: Change Tracker - highlights changes

Postby manns41078 on Tue Aug 06, 2013 9:28 pm

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!
manns41078
 
Posts: 1
Joined: Tue Aug 06, 2013 9:26 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: ctf0, Exabot [Bot] and 14 guests