summaryrefslogtreecommitdiff
path: root/alot/commands/bufferlist.py
blob: ae8ffc017d9d5304370a49c23f8967fc9753edb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from alot.commands import Command, registerCommand
from alot import buffers

MODE = 'bufferlist'


@registerCommand(MODE, 'select', help='focus selected buffer')
class BufferFocusCommand(Command):
    def apply(self, ui):
        selected = ui.current_buffer.get_selected_buffer()
        ui.buffer_focus(selected)


@registerCommand(MODE, 'close', help='close focussed buffer')
class BufferCloseCommand(Command):
    def apply(self, ui):
        selected = ui.current_buffer.get_selected_buffer()
        if isinstance(selected, buffers.SearchBuffer):
            selected.kill_filler_process()
        ui.buffer_close(selected)
        ui.buffer_focus(ui.current_buffer)