summaryrefslogtreecommitdiff
path: root/src/commands.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands.cc')
-rw-r--r--src/commands.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 9a50fdf5..e7faf5ec 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -880,7 +880,11 @@ const CommandDesc buffer_cmd = {
make_completer(menu(complete_buffer_name<true>)),
[](const ParametersParser& parser, Context& context, const ShellContext&)
{
- Buffer& buffer = parser.get_switch("matching") ? BufferManager::instance().get_buffer_matching(Regex{parser[0]})
+ Buffer& buffer = parser.get_switch("matching") ? BufferManager::instance().get_buffer_matching(
+ [re=Regex{parser[0]}](Buffer& buffer) {
+ auto name = buffer.name();
+ return regex_match(name.begin(), name.end(), re);
+ })
: BufferManager::instance().get_buffer(parser[0]);
if (&buffer != &context.buffer())
{