[rkward-cvs] SF.net SVN: rkward:[3629] trunk/rkward/rkward/windows/rkcommandeditorwindow .cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu May 26 18:14:49 UTC 2011


Revision: 3629
          http://rkward.svn.sourceforge.net/rkward/?rev=3629&view=rev
Author:   tfry
Date:     2011-05-26 18:14:49 +0000 (Thu, 26 May 2011)

Log Message:
-----------
Fix hickup when exporting from the console. Previous algo was wrong, when we skipped the first 2 chars, but the first used block started at char 1.

Modified Paths:
--------------
    trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2011-05-26 17:52:11 UTC (rev 3628)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2011-05-26 18:14:49 UTC (rev 3629)
@@ -1123,16 +1123,17 @@
 		}
 
 		int handledUntil = lineStart;
-		int remainingChars = line.length() - handledUntil;
+		int remainingChars = line.length();
 		foreach ( const KTextEditor::HighlightInterface::AttributeBlock& block, attribs ) {
 			if ((block.start + block.length) <= handledUntil) continue;
 			int start = qMax(block.start, lineStart);
 			if ( start > handledUntil ) {
 				ret += exportText( line.mid( handledUntil, start - handledUntil ), noAttrib, m_defaultAttribute );
 			}
-			int length = qMin(block.length, remainingChars);
+			int end = qMin (block.start + block.length, remainingChars);
+			int length = end - start;
 			ret += exportText( line.mid( start, length ), block.attribute, m_defaultAttribute);
-			handledUntil = start + length;
+			handledUntil = end;
 		}
 
 		if ( handledUntil < lineStart + remainingChars ) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list