ActiveState Community

Access DIFF utility?

Posted by nathan on 2009-05-19 13:19
OS: All / Any

Quick question;

Is there any way that I can access the diff utility (the one used by File > Show Unsaved Changes) from a Javascript macro?

Thanks.. :)

toddw | Tue, 2009-05-19 14:04

This is the implementation of the "Show Unsaved Changes" command:

// cmd_showUnsavedChanges
        view = ko.views.manager.currentView;
        var changes = view.document.getUnsavedChanges();
        ko.launch.diff(changes);
// cmd_showUnsavedChanges
        view = ko.views.manager.currentView;
        var changes = view.document.getUnsavedChanges();
        ko.launch.diff(changes);

You can see more details in Grok:
http://grok.openkomodo.com/source/search?q=cmd_showUnsavedChanges&path=%...

Cheers,
Todd

nathan | Tue, 2009-05-19 15:19

Hi Todd, Thanks for your reply.

I actually just meant the utility that "UnsavedChanges" uses.. I would like to use it to get the diff from 2 custom files I will provide..

toddw | Tue, 2009-05-19 15:28

Ah, I think you mean like the "Tools->Compare Files" feature then right?

ko.fileutils.showDiffs(filename1, filename2);
ko.fileutils.showDiffs(filename1, filename2);

That the one your after?

nathan | Wed, 2009-05-20 06:33

Thanks Todd, that's what I was looking for :)