complete_buffername try regex matching when prefix matching does not work
This commit is contained in:
parent
b630189ce5
commit
e00c811712
|
@ -3,6 +3,7 @@
|
||||||
#include "assert.hh"
|
#include "assert.hh"
|
||||||
#include "buffer.hh"
|
#include "buffer.hh"
|
||||||
#include "exception.hh"
|
#include "exception.hh"
|
||||||
|
#include "regex.hh"
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
@ -62,6 +63,17 @@ CandidateList BufferManager::complete_buffername(const String& prefix,
|
||||||
if (name.substr(0, real_prefix.length()) == real_prefix)
|
if (name.substr(0, real_prefix.length()) == real_prefix)
|
||||||
result.push_back(name);
|
result.push_back(name);
|
||||||
}
|
}
|
||||||
|
// no prefix completion found, check regex matching
|
||||||
|
if (result.empty())
|
||||||
|
{
|
||||||
|
Regex ex(real_prefix.begin(), real_prefix.end());
|
||||||
|
for (auto& buffer : m_buffers)
|
||||||
|
{
|
||||||
|
const String& name = buffer->name();
|
||||||
|
if (boost::regex_search(name.begin(), name.end(), ex))
|
||||||
|
result.push_back(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user