The branch, 2.0.x, has been updated.

- Log -----------------------------------------------------------------

commit 337bfa6010235a10751f1de451913cc8dbf4616d
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Sun Nov 6 22:36:14 2011 +0000

    Fix shortenng of file names in MakeDisplayPath.
    
    It is not a good idea to slice an utf8 string at arbitrary offsets, we have 
to work on a docstring instead.
    We need unfortunately to switch back and forth between utf8 and docstring.
    
    git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40149 
a592a061-630c-0410-9148-cb99ea01b6c8

diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp
index f7c48ca..10a9d8d 100644
--- a/src/support/filetools.cpp
+++ b/src/support/filetools.cpp
@@ -791,25 +791,26 @@ docstring const makeDisplayPath(string const & path, 
unsigned int threshold)
                return from_utf8(os::external_path(str));
 
        string const prefix = ".../";
-       string temp;
+       docstring dstr = from_utf8(str);
+       docstring temp;
 
-       while (str.length() > threshold)
-               str = split(str, temp, '/');
+       while (dstr.length() > threshold)
+               dstr = split(dstr, temp, '/');
 
        // Did we shorten everything away?
-       if (str.empty()) {
+       if (dstr.empty()) {
                // Yes, filename itself is too long.
                // Pick the start and the end of the filename.
-               str = onlyFileName(path);
-               string const head = str.substr(0, threshold / 2 - 3);
+               dstr = from_utf8(onlyFileName(path));
+               docstring const head = dstr.substr(0, threshold / 2 - 3);
 
-               string::size_type len = str.length();
-               string const tail =
-                       str.substr(len - threshold / 2 - 2, len - 1);
-               str = head + "..." + tail;
+               docstring::size_type len = dstr.length();
+               docstring const tail =
+                       dstr.substr(len - threshold / 2 - 2, len - 1);
+               dstr = head + from_ascii("...") + tail;
        }
 
-       return from_utf8(os::external_path(prefix + str));
+       return from_utf8(os::external_path(prefix + to_utf8(dstr)));
 }
 
 
diff --git a/status.20x b/status.20x
index 4a5206d..7416449 100644
--- a/status.20x
+++ b/status.20x
@@ -126,6 +126,8 @@ What's new
 
 - Remove annoying startup debug message.
 
+- Fix display of file names that contain many non-ascii characters.
+
 
 * DOCUMENTATION AND LOCALIZATION
 

-----------------------------------------------------------------------

Summary of changes:
 src/support/filetools.cpp |   23 ++++++++++++-----------
 status.20x                |    2 ++
 2 files changed, 14 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to