Sublime Forum

[BUG] DiffChangesCommand wrong syntax

#1

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:

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:

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

0 Likes

#2

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.

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

0 Likes