From: Guillaume Munch Date: Wed, 21 Oct 2015 14:02:12 +0000 (+0100) Subject: Amend bb344452 X-Git-Tag: 2.2.0alpha1~188 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=671c7e12e5812ddf4de6e1fadf59c98b6c081ab0;p=features.git Amend bb344452 Repair the senseless truncation on long file names --- diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index 6acfdf0df8..204c842652 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -942,11 +942,11 @@ docstring const makeDisplayPath(string const & path, unsigned int threshold) if (dstr.empty()) { // Yes, filename itself is too long. // Pick the start and the end of the filename. - dstr = from_utf8(onlyFileName(path)); - docstring::size_type const len = dstr.length(); - if (len >= threshold) - dstr = support::truncateWithEllipsis(dstr, threshold / 2) + - dstr.substr(len - threshold / 2 - 2, len - 1); + docstring fstr = from_utf8(onlyFileName(path)); + dstr = fstr; + if (support::truncateWithEllipsis(dstr, threshold / 2)) + dstr += fstr.substr(fstr.length() - threshold / 2 - 2, + docstring::npos); } return from_utf8(os::external_path(prefix + to_utf8(dstr)));