From 2db3b44e7e139c8d589b7f039a3086ed0c31e0cd Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Tue, 2 Oct 2001 18:00:43 +0000 Subject: [PATCH] bug in handling of strings that run off the right edge of the margin (in HTMLCheckerImpl) - thanks to Chuq von Rospach for reporting this --- .../htmlcheck/impl/HTMLCheckerImpl.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerImpl.java b/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerImpl.java index 16565f6..8edfa11 100644 --- a/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerImpl.java +++ b/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerImpl.java @@ -7,7 +7,7 @@ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific * language governing rights and limitations under the License. * - * The Original Code is the Venice Web Community System. + * The Original Code is the Venice Web Communities System. * * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are @@ -404,7 +404,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic private void emitFromStartOfTempBuffer(int nchars) { if (nchars<=0) - return; + return; // can't emit less than 1 character! if ((config.getWordWrapLength()>0) && (nobreak_count<=0)) { // we can output the line break anywhere in the subsequence... @@ -415,12 +415,16 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic if (curlen>remaining_space) curlen = remaining_space; - // output those characters - emitString(temp_buffer.substring(0,curlen),config.getOutputFilters(),true); - temp_buffer.delete(0,curlen); - nchars -= curlen; + // EJB 10/2/2001 - only output if we have something to output (and there is space for it) + if (curlen>0) + { // output those characters + emitString(temp_buffer.substring(0,curlen),config.getOutputFilters(),true); + temp_buffer.delete(0,curlen); + nchars -= curlen; - if (columns==config.getWordWrapLength()) + } // end if + + if (columns>=config.getWordWrapLength()) // EJB 10/2/2001 - might be greater emitLineBreak(); // and line break us to get to the next line } // end while @@ -750,7 +754,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic i++; break; - case '\r': // compress 1 or more \r's followe by optional \n to a single \n + case '\r': // compress 1 or more \r's followed by optional \n to a single \n if ( (i==(str.length()-1)) || ((str.charAt(i+1)!='\r') && (str.charAt(i+1)!='\n'))) temp_buffer.append('\n'); @@ -783,7 +787,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic i++; break; - case '\\': // backslash processing is complext - shift to ST_CHARS state to handle it + case '\\': // backslash processing is complex - shift to ST_CHARS state to handle it doFlushWhitespace(); state = ST_CHARS; break;