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

List:       kde-commits
Subject:    kdewebdev/quanta/parts/kafka
From:       Paulo Moura Guedes <moura () kdewebdev ! org>
Date:       2005-01-05 5:02:37
Message-ID: 20050105050237.D7D3C1CF85 () office ! kde ! org
[Download RAW message or body]

CVS commit by mojo: 

- Merge inline nodes when extracting text from a text node.
- Replace " " for "&nbsp;" if start and end nodes about to be merged, ends and begins \
                by a space, respectively.
- Set the cursor at the correct position after remove selected text.

P.S. This is very annoying so I'm committing.


  M +23 -1     kafkacommon.cpp   1.74
  M +6 -0      kafkahtmlpart.cpp   1.70


--- kdewebdev/quanta/parts/kafka/kafkacommon.cpp  #1.73:1.74
@@ -2183,5 +2183,13 @@ Node* kafkaCommon::DTDExtractNodeSubtree
     {
         Q_ASSERT(startNode->tag->type == Tag::Text || startNode->tag->type == \
                Tag::Empty);
-        return extractNode(startNode, modifs);
+        
+        Node* prev = startNode->prev;
+        Node* next = startNode->next;
+        
+        Node* aux = extractNode(startNode, modifs);
+        
+        mergeInlineNode(prev, next, cursorNode, cursorOffset, modifs);
+                
+        return aux;
     }
 
@@ -2819,4 +2827,18 @@ bool kafkaCommon::mergeNodes(Node *n, No
         }
 
+        // have in consideration two spaces in a row
+        QString nStr(n->tag->tagStr());
+        QString n2Str(n2->tag->tagStr());
+        if(nStr[nStr.length() - 1] == ' ' && n2Str[0] == ' ')
+        {
+            nStr = nStr.left(nStr.length() - 1);
+            nStr.append("&nbsp;");
+            n->tag->setStr(nStr);
+            
+            n2Str = n2Str.right(n2Str.length() - 1);
+            n2Str.prepend("&nbsp;");            
+            n2->tag->setStr(n2Str);
+        }
+
         if((n->tag->type == Tag::Text && n2->tag->type == Tag::Text) ||
                 (n->tag->type == Tag::Empty && n2->tag->type == Tag::Empty))

--- kdewebdev/quanta/parts/kafka/kafkahtmlpart.cpp  #1.69:1.70
@@ -2146,6 +2146,12 @@ void KafkaWidget::removeSelection()
     QTimer::singleShot(0, this, SLOT(slotDelayedSetCaretPosition()));
     
+    NodeSelection* cursorPos = new NodeSelection();
+    cursorPos->setCursorNode(cursorNode);
+    cursorPos->setCursorOffset(cursorOffset);
+    
     ViewManager::ref()->activeDocument()->docUndoRedo->addNewModifsSet(m_modifs, \
undoRedo::NodeTreeModif);  
+    delete cursorPos;
+
     makeCursorVisible();
 }


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

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