Skip to content

Commit

Permalink
allow to open multiple buffers of the same type
Browse files Browse the repository at this point in the history
We actively prevent opening multiple taglist or bufferlist buffers, but
so far allow to open multiple named query buffers. They cannot differ,
though, since there is nothing to configure about them.

Rather than confusing the user by behaving differently for different
buffer types, lift the restriction for all of them: at worst there are
multiple instances of buffers with the same content.

We do make a single exception for the bufferlist buffer because that is
the one you typically use to switch to other buffers.
  • Loading branch information
mjg committed Dec 29, 2020
1 parent f287d55 commit bf5bd3e
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions alot/commands/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,14 +566,7 @@ def __init__(self, filtfun=lambda x: x, tags=None, **kwargs):

def apply(self, ui):
tags = self.tags or ui.dbman.get_all_tags()
blists = ui.get_buffers_of_type(buffers.TagListBuffer)
if blists:
buf = blists[0]
buf.tags = tags
buf.rebuild()
ui.buffer_focus(buf)
else:
ui.buffer_open(buffers.TagListBuffer(ui, tags, self.filtfun))
ui.buffer_open(buffers.TagListBuffer(ui, tags, self.filtfun))


@registerCommand(MODE, 'namedqueries')
Expand Down

0 comments on commit bf5bd3e

Please sign in to comment.