[yast-commit] r67417 - /trunk/ncurses/src/NCRichText.cc

Author: gs Date: Mon Feb 13 12:09:37 2012 New Revision: 67417 URL: http://svn.opensuse.org/viewcvs/yast?rev=67417&view=rev Log: use boost::replace_all Modified: trunk/ncurses/src/NCRichText.cc Modified: trunk/ncurses/src/NCRichText.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCRichText.cc?rev=674... ============================================================================== --- trunk/ncurses/src/NCRichText.cc (original) +++ trunk/ncurses/src/NCRichText.cc Mon Feb 13 12:09:37 2012 @@ -45,6 +45,7 @@ #include "stringutil.h" #include "stdutil.h" #include <sstream> +#include <boost/algorithm/string.hpp> #include "YMenuItem.h" #include "YApplication.h" @@ -420,6 +421,10 @@ } +// +// Calculate longest line of text in <pre> </pre> tags +// and adjust the pad accordingly +// void NCRichText::AdjustPrePad( const wchar_t *osch ) { const wchar_t * wch = osch; @@ -443,14 +448,10 @@ // resolve the entities to get correct length for calculation of longest line wtxt = filterEntities( wtxt ); - wstring to_repl = L"<br>"; - size_t pos; - // replace <br> by \n to get appropriate lines in NCtext - for ( ; (pos = wtxt.find( to_repl )) != wstring::npos ; ) - wtxt.replace( pos, to_repl.length(), L"\n" ); - - yuiDebug() << "Input: " << wtxt << " olen: " << wch - osch << endl; + boost::replace_all( wtxt, L"<br>", L"\n" ); + + yuiDebug() << "Text: " << wtxt << " initial length: " << wch - osch << endl; NCstring nctxt( wtxt ); NCtext ftext( nctxt ); -- 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