1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-11 13:00:41 +03:00

Quote completions of regex options

Recent changes to `make_error_pattern` added a space to the default
value. This means that

	set g make_error_pattern <tab>

now produces an invalid command because regexes are not quoted.  We do
quote strings; regexes are not all that different so quote them too.
This commit is contained in:
Johannes Altmanninger 2023-11-12 20:50:48 +01:00
parent ed1e2f2e08
commit 118459db59
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,6 @@
#include "regex.hh"
#include "ranges.hh"
#include "string_utils.hh"
namespace Kakoune
{
@ -17,9 +18,9 @@ int Regex::named_capture_index(StringView name) const
return it != m_impl->named_captures.end() ? it->index : -1;
}
String option_to_string(const Regex& re)
String option_to_string(const Regex& re, Quoting quoting)
{
return re.str();
return option_to_string(re.str(), quoting);
}
Regex option_from_string(Meta::Type<Regex>, StringView str)

View File

@ -162,7 +162,8 @@ bool backward_regex_search(It begin, It end, It subject_begin, It subject_end,
return regex_search<It, RegexMode::Backward>(begin, end, subject_begin, subject_end, res, re, flags, idle_func);
}
String option_to_string(const Regex& re);
enum class Quoting;
String option_to_string(const Regex& re, Quoting quoting);
Regex option_from_string(Meta::Type<Regex>, StringView str);
template<typename Iterator, RegexMode mode = RegexMode::Forward,