summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-11-11 23:05:52 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2011-11-11 23:05:52 +0000
commit474fdd7f3f492c6d10de4140eb16dd1ded8857b6 (patch)
tree403b0b158f781acbcee8af7c6d265dad96dc84c1
parent09161c18f877903e31fb67292ce4fa8c775d5d78 (diff)
bufferlist love
-rw-r--r--alot/buffers.py2
-rw-r--r--alot/commands/bufferlist.py9
-rw-r--r--alot/commands/globals.py10
-rw-r--r--alot/ui.py5
4 files changed, 13 insertions, 13 deletions
diff --git a/alot/buffers.py b/alot/buffers.py
index fc485a08..7459c98f 100644
--- a/alot/buffers.py
+++ b/alot/buffers.py
@@ -67,8 +67,6 @@ class BufferlistBuffer(Buffer):
return self.ui.buffers.index(b)
def rebuild(self):
- self.ui.logger.debug('BUFFERS')
- self.ui.logger.debug(self.ui.buffers)
if self.isinitialized:
focusposition = self.bufferlist.get_focus()[1]
else:
diff --git a/alot/commands/bufferlist.py b/alot/commands/bufferlist.py
index ae8ffc01..eaf0ef73 100644
--- a/alot/commands/bufferlist.py
+++ b/alot/commands/bufferlist.py
@@ -14,8 +14,9 @@ class BufferFocusCommand(Command):
@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()
+ bufferlist = ui.current_buffer
+ selected = bufferlist.get_selected_buffer()
ui.buffer_close(selected)
- ui.buffer_focus(ui.current_buffer)
+ if bufferlist is not selected:
+ bufferlist.rebuild()
+ ui.update()
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 8b1ddc50..3739bd6f 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -33,7 +33,8 @@ class ExitCommand(Command):
if (yield ui.choice('realy quit?', select='yes', cancel='no',
msg_position='left')) == 'no':
return
- ui.dbman.kill_search_processes()
+ for b in ui.buffers:
+ b.cleanup()
ui.exit()
@@ -209,10 +210,7 @@ class PythonShellCommand(Command):
class BufferCloseCommand(Command):
def apply(self, ui):
selected = ui.current_buffer
- if isinstance(selected, buffers.SearchBuffer):
- selected.kill_filler_process()
ui.buffer_close(selected)
- ui.buffer_focus(ui.current_buffer)
@registerCommand(MODE, 'bprevious', forced={'offset': -1},
@@ -248,7 +246,9 @@ class OpenBufferlistCommand(Command):
if blists:
ui.buffer_focus(blists[0])
else:
- ui.buffer_open(buffers.BufferlistBuffer(ui, self.filtfun))
+ bl = buffers.BufferlistBuffer(ui, self.filtfun)
+ ui.buffer_open(bl)
+ bl.rebuild()
@registerCommand(MODE, 'taglist', help='opens taglist buffer')
diff --git a/alot/ui.py b/alot/ui.py
index 57a6406d..47e48a6d 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -230,12 +230,13 @@ class UI(object):
index = buffers.index(buf)
buffers.remove(buf)
offset = config.getint('general', 'bufferclose_focus_offset')
- self.current_buffer = buffers[(index + offset) % len(buffers)]
+ nextbuffer = buffers[(index + offset) % len(buffers)]
+ self.buffer_focus(nextbuffer)
else:
string = 'closing buffer %d:%s'
self.logger.debug(string % (buffers.index(buf), buf))
- index = buffers.index(buf)
buffers.remove(buf)
+ buf.cleanup()
def buffer_focus(self, buf):
"""