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

List:       kde-commits
Subject:    KDE/kdelibs/kate
From:       Hamish Rodda <rodda () kde ! org>
Date:       2005-10-01 3:50:55
Message-ID: 1128138655.904937.3032.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 465871 by rodda:

More bugs found in the SmartManager and SmartCursor
Cursor Feedback for intra-line edits seems to be working correctly

Fix one issue identified by source code checking


 M  +1 -1      part/katejscript.cpp  
 M  +4 -4      part/katesmartmanager.cpp  
 M  +1 -1      part/katesupercursor.cpp  
 M  +12 -0     tests/kateregression.cpp  


--- trunk/KDE/kdelibs/kate/part/katejscript.cpp #465870:465871
@@ -1119,7 +1119,7 @@
   QRegExp endExpr("[\\s\\t]*\\*\\*\\/[\\s\\t]*$");
   QRegExp keyValue("[\\s\\t]*\\*\\s*(.+):(.*)$");
   QRegExp blockContent("[\\s\\t]*\\*(.*)$");
-  while ((line=st.readLine())!=QString::null) {
+  while (!(line=st.readLine()).isNull()) {
     if (endExpr.exactMatch(line)) {
       kdDebug(13050)<<"end of config block"<<endl;
       if (currentState==NOTHING) break;
--- trunk/KDE/kdelibs/kate/part/katesmartmanager.cpp #465870:465871
@@ -206,7 +206,7 @@
 
   // Check to see if we need to split or consolidate
   int splitEndLine = edit->translate().line() + firstSmartGroup->endLine();
-  if (edit->translate().line() >= 0) {
+  if (edit->translate().line() > 0) {
     //kdDebug() << k_funcinfo << "Need to translate smartGroups by " << \
edit->translate().line() << " line(s); startLine " << firstSmartGroup->startLine() << \
" endLine " << firstSmartGroup->endLine() << " splitEndLine " << splitEndLine << "." \
<< endl;  KateSmartGroup* endGroup = currentGroup->next();
     int currentCanExpand = endGroup ? s_maximumGroupSize - currentGroup->length() : \
s_defaultGroupSize - currentGroup->length(); @@ -232,7 +232,7 @@
     }
 
 
-  } else {
+  } else if (edit->translate().line() < 0) {
     // might need to consolitate
     while (currentGroup->next() && currentGroup->length() - edit->translate().line() \
< s_minimumGroupSize)  currentGroup->merge();
@@ -248,7 +248,7 @@
 
   for (KateSmartGroup* smartGroup = currentGroup->next(); smartGroup; smartGroup = \
smartGroup->next()) {  if (groupChanged)
-      groupChanged = smartGroup->endLine() <= edit->oldRange().end().line(); // + \
edit->translate().line() +      groupChanged = smartGroup->startLine() <= \
edit->oldRange().end().line(); // + edit->translate().line()  
     if (groupChanged)
       smartGroup->translateChanged(*edit, changedRanges, false);
@@ -262,7 +262,7 @@
   groupChanged = true;
   for (KateSmartGroup* smartGroup = firstSmartGroup; smartGroup; smartGroup = \
smartGroup->next()) {  if (groupChanged)
-      groupChanged = smartGroup->endLine() <= edit->oldRange().end().line(); // + \
edit->translate().line() +      groupChanged = smartGroup->startLine() <= \
edit->oldRange().end().line(); // + edit->translate().line()  
     if (groupChanged)
       smartGroup->translatedChanged(*edit);
--- trunk/KDE/kdelibs/kate/part/katesupercursor.cpp #465870:465871
@@ -359,7 +359,7 @@
       m_watcher->positionChanged(this);
   }
 
-  if (!edit.oldRange().isEmpty() && edit.oldRange().contains(m_lastPosition)) {
+  if (!edit.oldRange().isEmpty() && edit.oldRange().start() <= m_lastPosition && \
edit.oldRange().end() >= m_lastPosition) {  if (edit.oldRange().start() == \
m_lastPosition) {  // character deleted after
       if (m_notifier)
--- trunk/KDE/kdelibs/kate/tests/kateregression.cpp #465870:465871
@@ -65,6 +65,13 @@
   COMPARE(*cursor1, KTextEditor::Cursor(0,0));
   COMPARE(*cursor2, KTextEditor::Cursor(1,14));
 
+  KTextEditor::Cursor cursor3 = m_doc->endOfLine(1);
+
+  // Set up a few more lines
+  m_doc->insertText(*cursor2, "\nEven More Test Text");
+  COMPARE(m_doc->end(), KTextEditor::Cursor(2,19));
+  COMPARE(cursor3, m_doc->endOfLine(1));
+
   // Intra-line insert
   KTextEditor::Cursor* cursorStartOfLine = \
m_doc->newSmartCursor(KTextEditor::Cursor(1,0));  
@@ -75,9 +82,13 @@
   KTextEditor::Cursor* cursorEOL = m_doc->newSmartCursor(m_doc->endOfLine(1), \
false);  KTextEditor::Cursor* cursorEOLMoves = \
m_doc->newSmartCursor(m_doc->endOfLine(1), true);  
+  KTextEditor::Cursor* cursorNextLine = \
m_doc->newSmartCursor(KTextEditor::Cursor(2,0)); +
+  addCursorExpectation(cursorStartOfLine, CursorSignalExpectation(false, false, \
false, false, false, false));  addCursorExpectation(cursorStartOfEdit, \
CursorSignalExpectation(false, false, false, true, false, false));  \
addCursorExpectation(cursorEndOfEdit, CursorSignalExpectation(false, false, true, \
false, true, false));  addCursorExpectation(cursorPastEdit, \
CursorSignalExpectation(false, false, false, false, true, false)); +  \
addCursorExpectation(cursorNextLine, CursorSignalExpectation(false, false, false, \
false, false, false));  
   m_doc->insertText(*cursorStartOfEdit, "Additional ");
   COMPARE(*cursorStartOfLine, KTextEditor::Cursor(1,0));
@@ -86,6 +97,7 @@
   COMPARE(*cursorPastEdit, KTextEditor::Cursor(1,18));
   COMPARE(*cursorEOL, m_doc->endOfLine(1));
   COMPARE(*cursorEOLMoves, m_doc->endOfLine(1));
+  COMPARE(*cursorNextLine, KTextEditor::Cursor(2,0));
 
   checkSignalExpectations();
 


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

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