Author: jonathan Date: Mon Sep 8 10:38:32 2008 New Revision: 21592 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=21592
Log: MASHUP-1096: inserted non-visible (zero width) spaces after / and & to allow long URLs to break more conveniently. This solves the IE issue in a limited way - long non-url strings won't break but this takes care of the most common cases. Modified: trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/QueryParamUtils.java Modified: trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/QueryParamUtils.java URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/QueryParamUtils.java?rev=21592&r1=21591&r2=21592&view=diff ============================================================================== --- trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/QueryParamUtils.java (original) +++ trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/QueryParamUtils.java Mon Sep 8 10:38:32 2008 @@ -146,13 +146,9 @@ - truncating a list may result in an orphaned bullet - whitespace collapsing may affect <pre> tags - visible markup won't be trimmed (e.g. <hr>, <img>) + - entities e.g. < are counted as 4 charactets instead of one. */ public static String trimVisibleChars(String markup, int length) { - // Optimization - if no trimming is necessary, return immediately. - if (markup.length() <= length) { - return markup; - } - String trimmedMarkup = ""; int charactersDisplayed = 0; boolean parsingTag = false; @@ -180,6 +176,7 @@ // this character is before the trimming mark, show it. trimmedMarkup += c; charactersDisplayed++; + } else { // now we're past the trimming mark, but we still might want to show a few characters. if (completingWord) { @@ -191,11 +188,15 @@ // now we just completed the word, no other visible characters will be displayed. // add an ellipsis to indicate that trimming occurred. completingWord = false; - trimmedMarkup += "…"; + trimmedMarkup += "…"; //… charactersDisplayed++; } } } + // insert invisible breaking characters between url segments to allow IE to wrap urls + if (c == '/' || (c ==';' && markup.charAt(i-4) == '&' && markup.charAt(i-3) == 'a' && markup.charAt(i-2) == 'm' && markup.charAt(i-1) == 'p')) { + trimmedMarkup += "​"; // zero-width space + } } } } _______________________________________________ Mashup-dev mailing list [email protected] http://mailman.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
