def on_text_command(self, view, command, args):
if command not in ['undo', 'unindent'] or view.name() != 'FileManager::input-for-path':
return
settings = view.settings()
if command == 'unindent':
index = settings.get('completions_index')
settings.set('go_backwards', True)
view.run_command('insert', {'characters': '\t'})
return
# command_history: (command, args, times)
first = view.command_history(0)
if first[0] != 'fm_edit_replace' or first[2] != 1:
return
second = view.command_history(-1)
if ((second[0] != 'reindent') and
not (second[0] == 'insert' and second[1] == {'characters': '\t'})):
return
settings.set('ran_undo', True)
view.run_command('undo')
index = settings.get('completions_index')
if index == 0 or index is None:
settings.erase('completions')
settings.erase('completions_index')
else:
settings.set('completions_index', index - 1)
评论列表
文章目录