def GundoPlayTo(): if not _check_sanity(): return target_n = GundoGetTargetState() back = int(vim.eval('g:mundo_target_n')) delay = int(vim.eval('g:mundo_playback_delay')) vim.command('echo "%s"' % back) util._goto_window_for_buffer(back) util.normal('zR') nodes, nmap = nodesData.make_nodes() start = nmap[nodesData.current()] end = nmap[target_n] def _walk_branch(origin, dest): rev = origin.n < dest.n nodes = [] if origin.n > dest.n: current, final = origin, dest else: current, final = dest, origin while current.n >= final.n: if current.n == final.n: break nodes.append(current) current = current.parent else: return None nodes.append(current) if rev: return reversed(nodes) else: return nodes branch = _walk_branch(start, end) if not branch: vim.command('unsilent echo "No path to that node from here!"') return for node in branch: util._undo_to(node.n) vim.command('GundoRenderGraph') util.normal('zz') util._goto_window_for_buffer(back) vim.command('redraw') vim.command('sleep %dm' % delay)
def MundoPlayTo(): if not _check_sanity(): return target_n = MundoGetTargetState() back = int(vim.eval("g:mundo_target_n")) delay = int(vim.eval("g:mundo_playback_delay")) vim.command('echo "%s"' % back) util._goto_window_for_buffer(back) util.normal("zR") nodes, nmap = nodesData.make_nodes() start = nmap[nodesData.current()] end = nmap[target_n] def _walk_branch(origin, dest): rev = origin.n < dest.n nodes = [] if origin.n > dest.n: current, final = origin, dest else: current, final = dest, origin while current.n >= final.n: if current.n == final.n: break nodes.append(current) current = current.parent else: return None nodes.append(current) if rev: return reversed(nodes) else: return nodes branch = _walk_branch(start, end) if not branch: vim.command('unsilent echo "No path to that node from here!"') return for node in branch: util._undo_to(node.n) vim.command("MundoRenderGraph") util.normal("zz") util._goto_window_for_buffer(back) vim.command("redraw") vim.command("sleep %dm" % delay)
def MundoPlayTo(): # {{{ """ Replays changes between the current state and a selected state in real-time. """ if not _check_sanity(): return target_n = MundoGetTargetState() back = int(vim.eval('g:mundo_target_n')) delay = int(vim.eval('g:mundo_playback_delay')) util._goto_window_for_buffer(back) util.normal('zn') nodes, nmap = nodesData.make_nodes() start = nmap[nodesData.current()] end = nmap[target_n] def _walk_branch(origin, dest): # {{{ rev = origin.n < dest.n nodes = [] if origin.n > dest.n: current, final = origin, dest else: current, final = dest, origin while current.n > final.n: nodes.append(current) current = current.parent if current.n != final.n: return None nodes.append(current) if rev: return reversed(nodes) else: return nodes # }}} branch = _walk_branch(start, end) if not branch: vim.command('unsilent echo "No path to that node from here!"') util.normal('zN') return for node in branch: util._undo_to(node.n) MundoRenderGraph() util.normal('zz') util._goto_window_for_buffer(back) vim.command('redraw | sleep %dm' % delay) util.normal('zN')
def MundoPlayTo():# {{{ """ Replays changes between the current state and a selected state in real-time. """ if not _check_sanity(): return target_n = MundoGetTargetState() back = int(vim.eval('g:mundo_target_n')) delay = int(vim.eval('g:mundo_playback_delay')) util._goto_window_for_buffer(back) util.normal('zn') nodes, nmap = nodesData.make_nodes() start = nmap[nodesData.current()] end = nmap[target_n] def _walk_branch(origin, dest):# {{{ rev = origin.n < dest.n nodes = [] if origin.n > dest.n: current, final = origin, dest else: current, final = dest, origin while current.n > final.n: nodes.append(current) current = current.parent if current.n != final.n: return None nodes.append(current) if rev: return reversed(nodes) else: return nodes # }}} branch = _walk_branch(start, end) if not branch: vim.command('unsilent echo "No path to that node from here!"') util.normal('zN') return for node in branch: util._undo_to(node.n) MundoRenderGraph() util.normal('zz') util._goto_window_for_buffer(back) vim.command('redraw | sleep %dm' % delay) util.normal('zN')