Skip to content

Commit

Permalink
Merge pull request #65 from demon386/master
Browse files Browse the repository at this point in the history
only record command that modifies the buffer (fix #53)
  • Loading branch information
seanliang committed Apr 27, 2016
2 parents 43f01a7 + a68e174 commit 19dceab
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ConvertToUTF8.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def setup_views():
for view in win.views():
if not get_setting(view, 'convert_on_load'):
break
view.settings().set('is_init_dirty_state', view.is_dirty())
if view.is_dirty() or view.settings().get('origin_encoding'):
show_encoding_status(view)
continue
Expand Down Expand Up @@ -624,11 +625,11 @@ def on_load(self, view):
encoding = view.encoding()
if encoding == 'Hexadecimal' or encoding.endswith(' BOM'):
return

#if sublime text already load right, no need to check the file's encoding
if encoding not in ('Undefined', view.settings().get('fallback_encoding')):
return

file_name = view.file_name()
if not file_name:
return
Expand Down Expand Up @@ -719,11 +720,13 @@ def on_modified(self, view):
return
if self.check_clones(view):
return
command = view.command_history(0)
command1 = view.command_history(1)
command = view.command_history(0, True)
command1 = view.command_history(1, True)
if command == NONE_COMMAND:
if command1[0] == 'convert_to_utf8':
view.run_command('redo')
else:
view.set_scratch(not view.settings().get('is_init_dirty_state', False))
elif command[0] == 'convert_to_utf8':
if file_name in stamps:
if stamps[file_name] == command[1].get('stamp'):
Expand Down

0 comments on commit 19dceab

Please sign in to comment.