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

List:       kde-commits
Subject:    kdelibs/kate/part
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2005-03-31 18:52:48
Message-ID: 20050331185248.579593C9 () office ! kde ! org
[Download RAW message or body]

CVS commit by cullmann: 

simple fix: don't add empty undogroups to the undo history, that would lead to \
activated undo/redo buttons without anything to undo and just undosteps which does \
nothing, not that nice :)


  M +10 -2     katedocument.cpp   1.815
  M +11 -5     kateundo.h   1.8


--- kdelibs/kate/part/katedocument.cpp  #1.814:1.815
@@ -1050,8 +1050,15 @@ void KateDocument::undoEnd()
   if (m_editCurrentUndo)
   {
-    if (!m_undoDontMerge && undoItems.last() && \
undoItems.last()->merge(m_editCurrentUndo,m_undoComplexMerge)) +    bool changedUndo \
= false; +
+    if (m_editCurrentUndo->isEmpty())
+      delete m_editCurrentUndo;
+    else if (!m_undoDontMerge && undoItems.last() && \
undoItems.last()->merge(m_editCurrentUndo,m_undoComplexMerge))  delete \
m_editCurrentUndo;  else
+    {
       undoItems.append(m_editCurrentUndo);
+      changedUndo = true;
+    }
 
     m_undoDontMerge = false;
@@ -1064,4 +1071,5 @@ void KateDocument::undoEnd()
     m_undoMergeTimer->start(5000, true);
 
+    if (changedUndo)
     emit undoChanged();
   }

--- kdelibs/kate/part/kateundo.h  #1.7:1.8
@@ -93,4 +93,10 @@ class KateUndoGroup
     */
     void safePoint (bool safePoint=true);
+
+    /**
+     * is this undogroup empty?
+     */
+    bool isEmpty () const { return m_items.isEmpty(); }
+
   private:
     /**


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

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