Home Download Buy Blog Forum Support

[BUG] DiffChangesCommand wrong syntax

[BUG] DiffChangesCommand wrong syntax

Postby bizoo on Tue Oct 04, 2011 12:38 pm

DiffChangesCommand doesn't set the correct syntax when not using the 'diff_changes_to_buffer' setting (didn't know this setting ?)

I suppose that this code:
Code: Select all
            v = win.get_output_panel('unsaved_changes')
            v.settings().set('syntax', 'Packages/Diff/Diff.tmLanguage')
            v.settings().set('word_wrap', self.view.settings().get('word_wrap'))

Must be replaced by this one:
Code: Select all
            v = win.get_output_panel('unsaved_changes')
            v.settings().set_syntax_file('Packages/Diff/Diff.tmLanguage')
            v.settings().set('word_wrap', self.view.settings().get('word_wrap'))


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

Re: [BUG] DiffChangesCommand wrong syntax

Postby bizoo on Tue Oct 04, 2011 12:44 pm

And in the same time, is it possible to modify this code to get the encoding of self.view and try opening the file with the same encoding ?
This way it will probably work for all files, not only UTF-8.
Code: Select all
        try:
            a = codecs.open(fname, "r", "utf-8").read().splitlines()
            b = self.view.substr(sublime.Region(0, self.view.size())).splitlines()
        except UnicodeDecodeError:
            sublime.status_message("Diff only works with UTF-8 files")
            return
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Majestic-12 [Bot] and 34 guests