[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/devtools/kte_quicksnippet/src
From:       Michaƫl Larouche <larouche () kde ! org>
Date:       2008-02-19 1:15:16
Message-ID: 1203383716.389425.28720.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 776909 by mlarouche:

Use the right way to remove text, more future proof



 M  +5 -3      quicksnippetview.cpp  


--- trunk/playground/devtools/kte_quicksnippet/src/quicksnippetview.cpp #776908:776909
@@ -120,9 +120,6 @@
 		}
 		while( !snippetStream.atEnd() && relativeColumn == -1 );
 
-		// Remove all occurences of $0..$9 from snippet
-		snippet.remove( caretMoveRegExp );
-
 		int beginLine = currentPos.line();
 		KTextEditor::Range editRange(currentPos.line(), wordColumnPosition,
 		                             currentPos.line(), currentPos.column());
@@ -135,6 +132,11 @@
 		if( carretPos.isValid() && relativeColumn != -1)
 		{
 			carretPos.setPosition( beginLine+relativeLine, relativeColumn );
+
+			// 2 is the length of $0..$9
+			KTextEditor::Range replaceRange(carretPos, 2);
+			doc->removeText( replaceRange );
+
 			d->editorView->setCursorPosition( carretPos );
 		}
 	}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic