コード例 #1
0
ファイル: mundo.py プロジェクト: randyransier/vimfiles
def _check_sanity():
    """ Check to make sure we're not crazy.

        Ensures that:
            * The target buffer exists, is loaded and is present in the tab.
            * That neovim is not in terminal mode.
    """
    global nodesData

    if not nodesData:
        nodesData = Nodes()

    # Check that the target buffer exists, is loaded and is present in the tab
    b = int(vim.eval('g:mundo_target_n'))

    if not vim.eval('bufloaded(%d)' % int(b)):
        vim.command('echo "%s"' % (MISSING_BUFFER % b))
        return False

    w = int(vim.eval('bufwinnr(%d)' % int(b)))

    if w == -1:
        vim.command('echo "%s"' % (MISSING_WINDOW % (w, b)))
        return False

    # Check if we are in terminal mode.
    mode = vim.eval('mode()')

    if mode == 't':
        return False

    return True
コード例 #2
0
ファイル: gundo.py プロジェクト: nepicleh/vim-mundo
def _check_sanity():
    '''Check to make sure we're not crazy.

    Does the following things:

        * Make sure the target buffer still exists.
    '''
    global nodesData
    if not nodesData:
        nodesData = Nodes()
    b = int(vim.eval('g:mundo_target_n'))

    if not vim.eval('bufloaded(%d)' % int(b)):
        vim.command('echo "%s"' % (MISSING_BUFFER % b))
        return False

    w = int(vim.eval('bufwinnr(%d)' % int(b)))
    if w == -1:
        vim.command('echo "%s"' % (MISSING_WINDOW % (w, b)))
        return False

    return True
コード例 #3
0
ファイル: mundo.py プロジェクト: randyransier/vimfiles
" J/K  - Next/Prev write state.
" i    - Toggle 'inline diff' mode.
" /    - Find changes that match string.
" n/N  - Next/Prev undo that matches search.
" P    - Play current state to selected undo.
" d    - Vert diff of undo with current state.
" p    - Diff of selected undo and current state.
" r    - Diff of selected undo and prior undo.
" q    - Quit!
" <cr> - Revert to selected state.

'''

# }}}

nodesData = Nodes()


# from profilehooks import profile
# @profile(immediate=True)
def MundoRenderGraph(force=False):  # {{{
    """ Renders the undo graph if necessary, updating it to reflect changes in
        the target buffer's undo tree.

        Arguments
        ---------
        force : bool
            If True, the graph will always be rendered. If False, then the
            graph may not be rendered - when is already current for example.
    """
    if not _check_sanity():
コード例 #4
0
ファイル: graphlog_test.py プロジェクト: zy6p/SpaceVim
def test_generate(mock_vim):
    eq_(graphlog.generate(False, 0, 1, 2, False, Nodes()),
        [['o ', '[0] Original   ']])