diff --git a/src/fdomenu.cc b/src/fdomenu.cc index f79109d49..58d6037e2 100644 --- a/src/fdomenu.cc +++ b/src/fdomenu.cc @@ -39,6 +39,8 @@ #include // For std::move #include +#include + #include #include @@ -670,11 +672,19 @@ struct AppEntry { ret += p.after; } } - if (prog_name_cut > 0 && ret.size() > prog_name_cut) { - ret.erase(prog_name_cut); - trimBack(ret); - ret += ellipsis; + if (prog_name_cut > 0) { + auto u16_conv = + wstring_convert, char16_t>{} + .from_bytes(ret); + if (u16_conv.size() > prog_name_cut) { + u16_conv.erase(prog_name_cut); + ret = wstring_convert, char16_t>{} + .to_bytes(u16_conv); + trimBack(ret); + ret += ellipsis; + } } + return ret; } };