summaryrefslogtreecommitdiff
path: root/alot/ui.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-06-26 20:19:09 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2012-06-26 20:19:09 +0100
commitb4108964261d2586401c232939c638be41ebd71a (patch)
tree108d25f52d5ad915fd6248fe06928d6572d5de26 /alot/ui.py
parent1e66018acc312c9bec6c21ce25cd5cac91f6762d (diff)
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
Diffstat (limited to 'alot/ui.py')
-rw-r--r--alot/ui.py7
1 files changed, 6 insertions, 1 deletions
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):