Beispiel #1
0
def MundoRenderPreview():# {{{
    """ Opens the preview window if necessary and renders a preview diff. """
    if not _check_sanity():
        return

    target_state = MundoGetTargetState()
    target_n = int(vim.eval('g:mundo_target_n'))

    # If there's no target state or the buffer has changed, update the cached
    # undo tree data, redraw the graph and abort preview rendering
    if target_state is None or nodesData.target_n != target_n:
        nodesData.make_nodes()
        MundoRenderGraph(True)
        return

    util._goto_window_for_buffer(target_n)
    nodes, nmap = nodesData.make_nodes()
    node_after = nmap[target_state]
    node_before = node_after.parent

    vim.command('call s:MundoOpenPreview()')
    util._output_preview_text(nodesData.preview_diff(node_before, node_after))

    # Mark the preview as up-to-date
    vim.command('call mundo#MundoPreviewOutdated(0)')
Beispiel #2
0
def MundoRenderPreview():  # {{{
    """ Opens the preview window if necessary and renders a preview diff. """
    if not _check_sanity():
        return

    target_state = MundoGetTargetState()
    target_n = int(vim.eval('g:mundo_target_n'))

    # If there's no target state or the buffer has changed, update the cached
    # undo tree data, redraw the graph and abort preview rendering
    if target_state is None or nodesData.target_n != target_n:
        nodesData.make_nodes()
        MundoRenderGraph(True)
        return

    util._goto_window_for_buffer(target_n)
    nodes, nmap = nodesData.make_nodes()
    node_after = nmap[target_state]
    node_before = node_after.parent

    vim.command('call s:MundoOpenPreview()')
    util._output_preview_text(nodesData.preview_diff(node_before, node_after))

    # Mark the preview as up-to-date
    vim.command('call mundo#MundoPreviewOutdated(0)')
Beispiel #3
0
def MundoRenderChangePreview():
    """ Render the selected undo level with the current file.
    Return True on success, False on failure. """
    if not _check_sanity():
        return

    vim.command("call s:MundoOpenPreview()")
    util._output_preview_text(MundoGetChangesForLine())

    util._goto_window_for_buffer_name("__Mundo__")

    return True
Beispiel #4
0
def GundoRenderChangePreview():
    """ Render the selected undo level with the current file.
    Return True on success, False on failure. """
    if not _check_sanity():
        return

    vim.command('call s:GundoOpenPreview()')
    util._output_preview_text(GundoGetChangesForLine())

    util._goto_window_for_buffer_name('__Mundo__')

    return True
Beispiel #5
0
def MundoRenderChangePreview():  # {{{
    """ Render a diff of the target buffer and the selected undo
        tree node. Returns True on success, False otherwise.
    """
    if not _check_sanity():
        return

    vim.command('call s:MundoOpenPreview()')
    util._output_preview_text(MundoGetChangesForLine())
    util._goto_window_for_buffer('__Mundo__')

    # Mark the preview as up-to-date
    vim.command('call mundo#MundoPreviewOutdated(0)')

    return True
Beispiel #6
0
def MundoRenderChangePreview():# {{{
    """ Render a diff of the target buffer and the selected undo
        tree node. Returns True on success, False otherwise.
    """
    if not _check_sanity():
        return

    vim.command('call s:MundoOpenPreview()')
    util._output_preview_text(MundoGetChangesForLine())
    util._goto_window_for_buffer('__Mundo__')

    # Mark the preview as up-to-date
    vim.command('call mundo#MundoPreviewOutdated(0)')

    return True
Beispiel #7
0
def MundoRenderPreview():
    if not _check_sanity():
        return

    target_state = MundoGetTargetState()
    # Check that there's an undo state. There may not be if we're talking about
    # a buffer with no changes yet.
    if target_state == None:
        util._goto_window_for_buffer_name("__Mundo__")
        return
    else:
        target_state = int(target_state)

    util._goto_window_for_buffer(vim.eval("g:mundo_target_n"))

    nodes, nmap = nodesData.make_nodes()

    node_after = nmap[target_state]
    node_before = node_after.parent

    vim.command("call s:MundoOpenPreview()")
    util._output_preview_text(nodesData.preview_diff(node_before, node_after))

    util._goto_window_for_buffer_name("__Mundo__")
Beispiel #8
0
def GundoRenderPreview():
    if not _check_sanity():
        return

    target_state = GundoGetTargetState()
    # Check that there's an undo state. There may not be if we're talking about
    # a buffer with no changes yet.
    if target_state == None:
        util._goto_window_for_buffer_name('__Mundo__')
        return
    else:
        target_state = int(target_state)

    util._goto_window_for_buffer(vim.eval('g:mundo_target_n'))

    nodes, nmap = nodesData.make_nodes()

    node_after = nmap[target_state]
    node_before = node_after.parent

    vim.command('call s:GundoOpenPreview()')
    util._output_preview_text(nodesData.preview_diff(node_before, node_after))

    util._goto_window_for_buffer_name('__Mundo__')