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

List:       kde-commits
Subject:    KDE_3_1_BRANCH: kdenetwork/ksirc
From:       Andrew Stanley-Jones <asj () cban ! com>
Date:       2003-01-22 16:41:31
[Download RAW message or body]

CVS commit by asj: 

2 more fixes backported from head


  M +21 -7     kstextview.cpp   1.69.2.3
  M +1 -1      kstextview.h   1.41.2.2


--- kdenetwork/ksirc/kstextview.cpp  #1.69.2.2:1.69.2.3
@@ -994,17 +994,24 @@ void TextLine::appendItem( Item *i, int 
 }
 
-void TextLine::resetLayout( QPtrList<Item> &remainingItems )
+Item *TextLine::resetLayout( QPtrList<Item> &remainingItems, Item *last )
 {
+    Item *lastLineItem = m_items.getLast();
     Item *it = m_items.first();
+    // We have to use the tobeDel structure or we call resetLayout on the Item
+    // twice for each item we want to delete
+    QPtrList<Item> tobeDel;
     while ( it )
     {
-        if ( it->resetLayout( remainingItems.getLast() ) == Item::KeepItem )
-        {
+        if ( it->resetLayout( last ) == Item::KeepItem )
+
             remainingItems.append( m_items.take() );
-            it = m_items.current();
-        }
         else
-            it = m_items.next();
+            tobeDel.append( m_items.take() );
+
+        it = m_items.current();
     }
+    m_items = tobeDel;
+    return lastLineItem;
+
 }
 
@@ -1096,6 +1103,7 @@ void TextParag::layout( int width )
 
     TextLine *row = m_lines.first();
+    Item *priorRowLast = 0x0;
     for (; row; row = m_lines.next() )
-        row->resetLayout( items );
+        priorRowLast = row->resetLayout( items, priorRowLast );
 
     m_lines.clear();
@@ -1493,5 +1501,11 @@ bool TextView::removeParag( const TextPa
         clearSelection( false );
 
+    int height = paragPtr->height();
     m_parags.removeRef( paragPtr );
+
+    if(m_selectionStart.item != 0)
+        m_selectionStart.pos.ry() -= height;
+    if(m_selectionEnd.item != 0)
+        m_selectionEnd.pos.ry() -= height;
 
     layout( true );

--- kdenetwork/ksirc/kstextview.h  #1.41.2.1:1.41.2.2
@@ -307,5 +307,5 @@ public:
     bool isEmpty() const { return m_items.isEmpty(); }
 
-    void resetLayout( QPtrList<Item> &remainingItems );
+    Item *resetLayout( QPtrList<Item> &remainingItems, Item *last );
 
     void paint( QPainter *p, int y );


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

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