aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/fmt.hh
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2022-01-24 10:07:02 +0100
committerregnat <rg@regnat.ovh>2022-01-24 10:07:02 +0100
commitffb28eaa1e15f85d3fbf6bfc3a04a4010f9c80c9 (patch)
treeb7548e543f47051f32bfba2095d935e4d8f676dd /src/libutil/fmt.hh
parentf82a426502dfd8f583eff3e8b0b895989e10d730 (diff)
Add a small documentation for `hiliteMatches`
Diffstat (limited to 'src/libutil/fmt.hh')
-rw-r--r--src/libutil/fmt.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libutil/fmt.hh b/src/libutil/fmt.hh
index 06c4a2049..1f81bfcfb 100644
--- a/src/libutil/fmt.hh
+++ b/src/libutil/fmt.hh
@@ -156,5 +156,12 @@ 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(const std::string &s, std::vector<std::smatch> matches, std::string prefix, std::string postfix);
}