summaryrefslogtreecommitdiff
path: root/src/string_utils.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2022-02-22 20:14:47 +1100
committerMaxime Coste <mawww@kakoune.org>2022-03-06 10:13:14 +1100
commit70610017284af7effd675bd927ae25b084b3e4b9 (patch)
treea7c883a919f64d4d3828b074f4707b3272460cd0 /src/string_utils.cc
parentb915e4e11b666b72607b8c22044f5e20d9107cdd (diff)
Add a complete-command command to configure command completion
This makes it possible to change command completion in hooks and paves the way to more flexibility in how custom commands can be completed
Diffstat (limited to 'src/string_utils.cc')
-rw-r--r--src/string_utils.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/string_utils.cc b/src/string_utils.cc
index a1c1c38d..37ca6716 100644
--- a/src/string_utils.cc
+++ b/src/string_utils.cc
@@ -396,6 +396,16 @@ UnitTest test_string{[]()
{
kak_assert(String("youpi ") + "matin" == "youpi matin");
+ kak_assert(StringView{"youpi"}.starts_with(""));
+ kak_assert(StringView{"youpi"}.starts_with("you"));
+ kak_assert(StringView{"youpi"}.starts_with("youpi"));
+ kak_assert(not StringView{"youpi"}.starts_with("youpi!"));
+
+ kak_assert(StringView{"youpi"}.ends_with(""));
+ kak_assert(StringView{"youpi"}.ends_with("pi"));
+ kak_assert(StringView{"youpi"}.ends_with("youpi"));
+ kak_assert(not StringView{"youpi"}.ends_with("oup"));
+
auto wrapped = "wrap this paragraph\n respecting whitespaces and much_too_long_words" | wrap_at(16) | gather<Vector>();
kak_assert(wrapped.size() == 6);
kak_assert(wrapped[0] == "wrap this");