"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/qcodeedit/lib/qeditor.cpp" between
texstudio-3.1.0.tar.gz and texstudio-3.1.1.tar.gz

About: TeXstudio is an integrated environment for writing LaTeX documents (as easy and comfortable as possible).

qeditor.cpp  (texstudio-3.1.0):qeditor.cpp  (texstudio-3.1.1)
skipping to change at line 2763 skipping to change at line 2763
insertAtLineStart(m, txt); insertAtLineStart(m, txt);
m_doc->endMacro(); m_doc->endMacro();
} else if ( !protectedCursor(m_cursor) ) { } else if ( !protectedCursor(m_cursor) ) {
m_definition->clearMatches(m_doc); // Matches are not handled in side comments. We have to remove them. Otherwise they will stay forever in the c omment line. m_definition->clearMatches(m_doc); // Matches are not handled in side comments. We have to remove them. Otherwise they will stay forever in the c omment line.
if ( !m_cursor.hasSelection() ) if ( !m_cursor.hasSelection() )
insertAtLineStart(m_cursor, txt); insertAtLineStart(m_cursor, txt);
else { else {
QDocumentSelection s = m_cursor.selection(); QDocumentSelection s = m_cursor.selection();
if ( s.end == 0 && s.startLine < s.endLine ) if ( s.end == 0 && s.startLine < s.endLine )
s.endLine--; //only change last line if there is s.endLine--; //only change last line if there is selected text
selected text
QDocumentCursor c(m_doc, s.startLine); QDocumentCursor c(m_doc, s.startLine);
c.setSilent(true); c.setSilent(true);
c.beginEditBlock(); c.beginEditBlock();
while ( c.isValid() && (c.lineNumber() <= s.endLine) ) while ( c.isValid() && (c.lineNumber() <= s.endLine) )
{ {
c.insertText(txt); c.insertText(txt);
c.movePosition(1, QDocumentCursor::NextLine, QDoc umentCursor::ThroughFolding); c.movePosition(1, QDocumentCursor::NextLine, QDoc umentCursor::ThroughFolding);
if ( c.atEnd() ) if ( c.atEnd() )
skipping to change at line 2848 skipping to change at line 2848
{ {
if ( !m_definition ) if ( !m_definition )
return; return;
QString commentMark = m_definition->singleLineComment(); QString commentMark = m_definition->singleLineComment();
bool allCommented = true; bool allCommented = true;
foreach (const QDocumentCursor &cursor, cursors()) { foreach (const QDocumentCursor &cursor, cursors()) {
if (cursor.hasSelection()) { if (cursor.hasSelection()) {
QDocumentCursor cur = cursor.selectionStart(); QDocumentCursor cur = cursor.selectionStart();
for (int i = 0; i < cursor.endLineNumber() - cursor.start for (int i = cursor.startLineNumber(); i <= cursor.endLineNumber() ;
LineNumber() + 1; i++) { ++i) {
if (!cur.line().startsWith(commentMark)) { if (!cur.line().startsWith(commentMark) && (i<cursor.endLineNumb
er() || !cur.line().text().isEmpty())) { //special treatmenat of last line if em
pty
allCommented = false; allCommented = false;
break; break;
} }
cur.movePosition(1, QDocumentCursor::NextLine); cur.movePosition(1, QDocumentCursor::NextLine);
} }
} else { } else {
if (!cursor.line().startsWith(commentMark)) { if (!cursor.line().startsWith(commentMark)) {
allCommented = false; allCommented = false;
} }
} }
 End of changes. 2 change blocks. 
6 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)