[yast-commit] r62633 - in /branches/SuSE-Code-11-SP2-Branch/ncurses: package/yast2-ncurses.changes src/NCRichText.cc
Author: gs Date: Wed Oct 13 14:39:51 2010 New Revision: 62633 URL: http://svn.opensuse.org/viewcvs/yast?rev=62633&view=rev Log: bug-fix for pre tag Modified: branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCRichText.cc Modified: branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes?rev=62633&r1=62632&r2=62633&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes Wed Oct 13 14:39:51 2010 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Wed Oct 13 14:26:38 CEST 2010 - gs@suse.de + +- NCRichText: bug-fix for pre tag (bnc #484629) + +------------------------------------------------------------------- Thu May 6 14:07:23 CEST 2010 - gs@suse.de - NCTextPad: do not append \n after the very last line Modified: branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCRichText.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCRichText.cc?rev=62633&r1=62632&r2=62633&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCRichText.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCRichText.cc Wed Oct 13 14:39:51 2010 @@ -160,6 +160,11 @@ , NCPadWidget( parent ) , text( ntext ) , plainText( plainTextMode ) + , textwidth( 0 ) + , cl( 0 ) + , cc( 0 ) + , cindent( 0 ) + , atbol( true ) , preTag( false ) , Tattr( 0 ) { @@ -447,6 +452,8 @@ { myPad()->addwstr( wch, 1 ); // add the wide chararacter cc += wcwidth( *wch ); + if ( *wch == '\n' ) + PadNL(); } ++wch; } @@ -454,14 +461,16 @@ break; case L'<': - swch = wch; - SkipToken( wch ); - - if ( PadTOKEN( swch, wch ) ) - break; // strip token - else - wch = swch; // reset and fall through + if ( !preTag ) + { + swch = wch; + SkipToken( wch ); + if ( PadTOKEN( swch, wch ) ) + break; // strip token + else + wch = swch; // reset and fall through + } default: swch = wch; @@ -474,6 +483,8 @@ { SkipPreTXT( wch ); PadPlainTXT( swch, wch - swch ); + preTag = false; + PadNL(); // add new line after pre is closed } break; @@ -563,7 +574,8 @@ } /** - * Get the number of columns needed to print a 'wstring'. + * Get the number of columns needed to print a 'wstring'. Only printable characters + * are taken into account because others would return -1 (e.g. '\n'). * Attention: only use textWidth() to calculate space, not for iterating through a text * or to get the length of a text (real text length includes new lines). */ @@ -574,7 +586,9 @@ for ( wstr_it = wstr.begin(); wstr_it != wstr.end() ; ++wstr_it ) { - len += wcwidth( *wstr_it ); + // check whether char is printable + if ( iswprint( *wstr_it ) ) + len += wcwidth( *wstr_it ); } return len; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn2.opensuse.org