aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.cpp
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-09-25 18:04:11 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-09-25 18:04:11 -0700
commitcd4fa518b86ddfb3e946fa4dd69e9e32a58ef81e (patch)
tree8d0a45f9101c833c6f5442557534714bea381b46 /common.cpp
parent316d7004a3d4f6905f36301b6d5c9ebd934f11fa (diff)
Remove my_wcswidth() in favor of fish_wcswidth()
my_wcswidth() was just a wrapper around fish_wcswidth() already. Instead, add two convenience overrides of fish_wcswidth() to common.h that make it a drop-in replacement for my_wcswidth().
Diffstat (limited to 'common.cpp')
-rw-r--r--common.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/common.cpp b/common.cpp
index ad35470e..7429fcbe 100644
--- a/common.cpp
+++ b/common.cpp
@@ -513,13 +513,14 @@ bool wcsvarchr(wchar_t chr)
return iswalnum(chr) || chr == L'_';
}
+int fish_wcswidth(const wchar_t *str)
+{
+ return fish_wcswidth(str, wcslen(str));
+}
-/**
- The glibc version of wcswidth seems to hang on some strings. fish uses this replacement.
-*/
-int my_wcswidth(const wchar_t *c)
+int fish_wcswidth(const wcstring& str)
{
- return fish_wcswidth(c, wcslen(c));
+ return fish_wcswidth(str.c_str(), str.size());
}
wchar_t *quote_end(const wchar_t *pos)