blob: 1a9bbdebe1c7471b1bbd37ca057cd3c283095b14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
from __future__ import absolute_import
from ..commands import Command, registerCommand
from . import globals
MODE = 'bufferlist'
@registerCommand(MODE, 'open')
class BufferFocusCommand(Command):
"""focus selected buffer"""
def apply(self, ui):
selected = ui.current_buffer.get_selected_buffer()
ui.buffer_focus(selected)
@registerCommand(MODE, 'close')
class BufferCloseCommand(Command):
"""close focussed buffer"""
def apply(self, ui):
bufferlist = ui.current_buffer
selected = bufferlist.get_selected_buffer()
d = ui.apply_command(globals.BufferCloseCommand(buffer=selected))
def cb(_):
if bufferlist is not selected:
bufferlist.rebuild()
ui.update()
d.addCallback(cb)
return d
|