From 5ec6d8c558a6be96207086c16700cd783c9af57d Mon Sep 17 00:00:00 2001 From: "philringnalda%gmail.com" Date: Sun, 26 Aug 2007 03:20:24 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20392718=20=EF=BF=BD=EF=BF=BD=EF=BF=BD=20Wi?= =?UTF-8?q?th=20beautified=20ftp=20listings,=20long=20filenames=20are=20tr?= =?UTF-8?q?uncated,=20making=20them=20hard=20to=20read,=20patch=20by=20D?= =?UTF-8?q?=EF=BF=BD=EF=BF=BDo=20Gottwald=20,=20r+sr+a?= =?UTF-8?q?1.9=3Dbz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netwerk/streamconv/converters/nsIndexedToHTML.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp index 71aadc0f7f3..00a8cca858c 100644 --- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp +++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp @@ -809,7 +809,7 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest, // Truncate long names to not stretch the table //XXX this should be left to the stylesheet (bug 391471) nsString escapedShort; - if (description.Length() > 31) { + if (description.Length() > 46) { nsCOMPtr channel = do_QueryInterface(aRequest); nsCOMPtr uri; rv = channel->GetURI(getter_AddRefs(uri)); @@ -819,13 +819,22 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest, PRBool isSchemeGopher = PR_FALSE; if (!(NS_SUCCEEDED(uri->SchemeIs("gopher", &isSchemeGopher)) && isSchemeGopher)) { //XXX this potentially truncates after a combining char (bug 391472) + nsXPIDLString descriptionAffix; + descriptionAffix.Assign(description); + descriptionAffix.Cut(0, descriptionAffix.Length() - 15); + if (NS_IS_LOW_SURROGATE(descriptionAffix.First())) + descriptionAffix.Cut(0, 1); description.Truncate(30); if (NS_IS_HIGH_SURROGATE(description.Last())) - description.Truncate(description.Length()-1); + description.Truncate(description.Length() - 1); escapedShort.Adopt(nsEscapeHTML2(description.get(), description.Length())); // add HORIZONTAL ELLIPSIS (U+2026) escapedShort.AppendLiteral("…"); + nsString tmp; + tmp.Adopt(nsEscapeHTML2(descriptionAffix.get(), descriptionAffix.Length())); + escapedShort.Append(tmp); + pushBuffer.AppendLiteral(" title=\""); pushBuffer.Append(escaped); pushBuffer.AppendLiteral("\"");