From b4108964261d2586401c232939c638be41ebd71a Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Tue, 26 Jun 2012 20:19:09 +0100 Subject: insert new buffers relative to current buffer .. in UI's bufferlist. This results in a more natural bufferflow when going from a search to thread and back by closing the thread. cf issue #478 --- alot/ui.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'alot/ui.py') diff --git a/alot/ui.py b/alot/ui.py index 9e5e81b0..bb106cfc 100644 --- a/alot/ui.py +++ b/alot/ui.py @@ -198,7 +198,12 @@ class UI(object): def buffer_open(self, buf): """register and focus new :class:`~alot.buffers.Buffer`.""" - self.buffers.append(buf) + if self.current_buffer is not None: + offset = settings.get('bufferclose_focus_offset') * -1 + currentindex = self.buffers.index(self.current_buffer) + self.buffers.insert(currentindex + offset, buf) + else: + self.buffers.append(buf) self.buffer_focus(buf) def buffer_close(self, buf): -- cgit v1.2.3