mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-25 20:41:49 +03:00
Filters: generalize colorize_regex in colorize_regex_range
This commit is contained in:
parent
2549a63c0b
commit
ea2aeea3a4
@ -9,12 +9,16 @@
|
|||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
void colorize_regex(DisplayBuffer& display_buffer,
|
void colorize_regex_range(DisplayBuffer& display_buffer,
|
||||||
const boost::regex& ex,
|
const BufferIterator& range_begin,
|
||||||
Color fg_color, Color bg_color = Color::Default)
|
const BufferIterator& range_end,
|
||||||
|
const boost::regex& ex,
|
||||||
|
Color fg_color, Color bg_color = Color::Default)
|
||||||
{
|
{
|
||||||
BufferIterator display_begin = display_buffer.begin()->begin();
|
BufferIterator display_begin = std::max(range_begin,
|
||||||
BufferIterator display_end = display_buffer.back().end();
|
display_buffer.front().begin());
|
||||||
|
BufferIterator display_end = std::min(range_end,
|
||||||
|
display_buffer.back().end());
|
||||||
|
|
||||||
boost::regex_iterator<BufferIterator> re_it(display_begin, display_end,
|
boost::regex_iterator<BufferIterator> re_it(display_begin, display_end,
|
||||||
ex, boost::match_nosubs);
|
ex, boost::match_nosubs);
|
||||||
@ -48,6 +52,14 @@ void colorize_regex(DisplayBuffer& display_buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void colorize_regex(DisplayBuffer& display_buffer,
|
||||||
|
const boost::regex& ex,
|
||||||
|
Color fg_color, Color bg_color = Color::Default)
|
||||||
|
{
|
||||||
|
colorize_regex_range(display_buffer, display_buffer.front().begin(),
|
||||||
|
display_buffer.back().end(), ex, fg_color, bg_color);
|
||||||
|
}
|
||||||
|
|
||||||
Color parse_color(const std::string& color)
|
Color parse_color(const std::string& color)
|
||||||
{
|
{
|
||||||
if (color == "default") return Color::Default;
|
if (color == "default") return Color::Default;
|
||||||
|
Loading…
Reference in New Issue
Block a user