FileManager.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:FileManager 作者: math2001 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号