main.py 文件源码

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

项目:Sublundo 作者: libundo 项目源码 文件源码
def run(self, edit, command, in_vis=False):
        """Update the current view with the result of calling `undo` or `redo`.

        Args:
            command (str): 'undo', 'redo', or 'redo_or_repeat'.
            in_vis (bool): `True` if we were called from `sublundo_next_node`.
        """
        t = util.VIEW_TO_TREE[self.view.id()]['tree']
        pos = 0
        if command == 'undo':
            buf, diff, pos = t.undo()
        else:
            buf, diff, pos = t.redo()

        self.view.replace(edit, sublime.Region(0, self.view.size()), buf)

        # Re-position the cursor.
        self.view.sel().clear()
        self.view.sel().add(sublime.Region(pos))
        self.view.show(pos)

        p = sublime.active_window().find_output_panel('sublundo')
        if all([p, diff, in_vis]):
            p.replace(edit, sublime.Region(0, p.size()), diff)
            self.view.add_regions(
                'sublundo',
                [self.view.full_line(pos)],
                'invalid',
                '',
                sublime.DRAW_NO_FILL)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号