forked from lix-project/lix
Merge pull request #6433 from edolstra/hilite
Move hiliteMatches into a separate header
This commit is contained in:
commit
dea76f581b
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <boost/format.hpp>
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include "ansicolor.hh"
|
||||
|
||||
|
||||
|
@ -155,15 +154,4 @@ inline hintformat hintfmt(std::string plain_string)
|
|||
return hintfmt("%s", normaltxt(plain_string));
|
||||
}
|
||||
|
||||
/* Highlight all the given matches in the given string `s` by wrapping
|
||||
them between `prefix` and `postfix`.
|
||||
|
||||
If some matches overlap, then their union will be wrapped rather
|
||||
than the individual matches. */
|
||||
std::string hiliteMatches(
|
||||
std::string_view s,
|
||||
std::vector<std::smatch> matches,
|
||||
std::string_view prefix,
|
||||
std::string_view postfix);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#include "fmt.hh"
|
||||
|
||||
#include <regex>
|
||||
#include "hilite.hh"
|
||||
|
||||
namespace nix {
|
||||
|
20
src/libutil/hilite.hh
Normal file
20
src/libutil/hilite.hh
Normal file
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include <regex>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace nix {
|
||||
|
||||
/* Highlight all the given matches in the given string `s` by wrapping
|
||||
them between `prefix` and `postfix`.
|
||||
|
||||
If some matches overlap, then their union will be wrapped rather
|
||||
than the individual matches. */
|
||||
std::string hiliteMatches(
|
||||
std::string_view s,
|
||||
std::vector<std::smatch> matches,
|
||||
std::string_view prefix,
|
||||
std::string_view postfix);
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
#include "shared.hh"
|
||||
#include "eval-cache.hh"
|
||||
#include "attr-path.hh"
|
||||
#include "fmt.hh"
|
||||
#include "hilite.hh"
|
||||
|
||||
#include <regex>
|
||||
#include <fstream>
|
||||
|
|
Loading…
Reference in a new issue