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

List:       kde-commits
Subject:    KDE/kdelibs/kate
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2010-08-29 13:17:45
Message-ID: 20100829131745.07708AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1169512 by cullmann:

less complexity

 M  +0 -1      CMakeLists.txt  
 M  +7 -2      completion/katecompletionwidget.cpp  
 M  +1 -18     document/katedocument.cpp  
 M  +25 -4     document/katedocument.h  
 D             document/kateedit.cpp  
 D             document/kateedit.h  


--- trunk/KDE/kdelibs/kate/CMakeLists.txt #1169511:1169512
@@ -69,7 +69,6 @@
 document/katedocument.cpp
 document/katedocumenthelpers.cpp
 document/katebuffer.cpp
-document/kateedit.cpp
 
 # undo
 undo/kateundo.cpp
--- trunk/KDE/kdelibs/kate/completion/katecompletionwidget.cpp #1169511:1169512
@@ -1221,9 +1221,10 @@
   m_automaticInvocationDelay = delay;
 }
 
+void KateCompletionWidget::wrapLine (const KTextEditor::Cursor &)
+{
+  m_lastInsertionByUser = !m_completionEditRunning;
 
-void KateCompletionWidget::wrapLine (const KTextEditor::Cursor &position)
-{
   // wrap line, be done
   m_automaticInvocationLine.clear();
   m_automaticInvocationTimer->stop();
@@ -1231,6 +1232,8 @@
 
 void KateCompletionWidget::unwrapLine (int)
 {
+  m_lastInsertionByUser = !m_completionEditRunning;
+  
   // just removal
   m_automaticInvocationLine.clear();
   m_automaticInvocationTimer->stop();
@@ -1266,6 +1269,8 @@
 
 void KateCompletionWidget::removeText (const KTextEditor::Range &)
 {
+  m_lastInsertionByUser = !m_completionEditRunning;
+
   // just removal
   m_automaticInvocationLine.clear();
   m_automaticInvocationTimer->stop();
--- trunk/KDE/kdelibs/kate/document/katedocument.cpp #1169511:1169512
@@ -40,7 +40,6 @@
 #include "katemodemanager.h"
 #include "kateschema.h"
 #include "katetemplatehandler.h"
-#include "kateedit.h"
 #include "katebuffer.h"
 #include "kateundomanager.h"
 #include "katepartpluginmanager.h"
@@ -170,7 +169,6 @@
   editSessionNumber(0),
   editIsRunning(false),
   m_undoManager(new KateUndoManager(this)),
-  m_editHistory(new KateEditHistory(this)),
   m_editableMarks(markType01),
   m_annotationModel(0),
   m_saveAs(false),
@@ -1048,8 +1046,6 @@
   // insert text into line
   m_buffer->insertText (KTextEditor::Cursor (line, col2), s2);
 
-  history()->doEdit( new KateEditInfo(m_editSources.top(), KTextEditor::Range(line, \
                col2, line, col),
-              QStringList(), KTextEditor::Range(line, col2, line, col2 + \
s2.length()), QStringList(s2)) );  emit KTextEditor::Document::textInserted(this, \
KTextEditor::Range(line, col2, line, col2 + s2.length()));  
   editEnd();
@@ -1089,7 +1085,6 @@
 
   removeTrailingSpace( line );
 
-  history()->doEdit( new KateEditInfo(m_editSources.top(), KTextEditor::Range(line, \
col, line, col + len), QStringList(l->string().mid(col, len)), \
KTextEditor::Range(line, col, line, col), QStringList()) );  emit \
KTextEditor::Document::textRemoved(this, KTextEditor::Range(line, col, line, col + \
len));  emit KTextEditor::Document::textRemoved(this, KTextEditor::Range(line, col, \
line, col + len), oldText);  
@@ -1175,8 +1170,6 @@
     // yes, we added a new line !
     if (newLineAdded)
       (*newLineAdded) = true;
-
-    history()->doEdit( new KateEditInfo(m_editSources.top(), \
KTextEditor::Range(line, col, line, col), QStringList(), KTextEditor::Range(line, \
col, line+1, 0), QStringList()) );  }
   else
   {
@@ -1186,8 +1179,6 @@
     // no, no new line added !
     if (newLineAdded)
       (*newLineAdded) = false;
-
-    history()->doEdit( new KateEditInfo(m_editSources.top(), \
KTextEditor::Range(line, col, line+1, 0), QStringList(), KTextEditor::Range(line, \
col, line+1, pos), QStringList()) );  }
 
   emit KTextEditor::Document::textInserted(this, KTextEditor::Range(line, col, \
line+1, pos)); @@ -1256,7 +1247,6 @@
   if( !list.isEmpty() )
     emit marksChanged( this );
 
-  history()->doEdit( new KateEditInfo(m_editSources.top(), KTextEditor::Range(line, \
col, line+1, 0), QStringList(QString()), KTextEditor::Range(line, col, line, col), \
QStringList()) );  emit KTextEditor::Document::textRemoved(this, \
KTextEditor::Range(line, col, line+1, 0));  
   editEnd ();
@@ -1324,7 +1314,6 @@
     rangeInserted.end().setPosition(line + 1, 0);
   }
 
-  history()->doEdit( new KateEditInfo(m_editSources.top(), \
KTextEditor::Range(rangeInserted.start(), rangeInserted.start()), QStringList(), \
rangeInserted, QStringList(s)) );  emit KTextEditor::Document::textInserted(this, \
rangeInserted);  
   editEnd ();
@@ -1404,7 +1393,6 @@
     }
   }
 
-  history()->doEdit(new KateEditInfo(m_editSources.top(), rangeRemoved, oldText, \
KTextEditor::Range(rangeRemoved.start(), rangeRemoved.start()), QStringList()));  \
emit KTextEditor::Document::textRemoved(this, rangeRemoved);  
   editEnd();
@@ -1972,7 +1960,6 @@
     setEncoding (mimeType.mid(pos+1));
 
   // do we have success ?
-  history()->doEdit( new KateEditInfo(Kate::CloseFileEdit, documentRange(), \
QStringList(), KTextEditor::Range(0,0,0,0), QStringList()) );  emit \
KTextEditor::Document::textRemoved(this, documentRange());  
   bool success = m_buffer->openFile (localFilePath());
@@ -1981,8 +1968,6 @@
   foreach (KateView * view, m_views)
     view->setUpdatesEnabled (false);
 
-  history()->doEdit( new KateEditInfo(Kate::OpenFileEdit, \
                KTextEditor::Range(0,0,0,0), QStringList(), documentRange(), \
                QStringList()) );
-
   //
   // yeah, success
   //
@@ -2430,8 +2415,6 @@
   emit KTextEditor::Document::textRemoved(this, documentRange());
 
   {
-    history()->doEdit( new KateEditInfo(Kate::CloseFileEdit, documentRange(), \
                QStringList(), KTextEditor::Range(0,0,0,0), QStringList()) );
-
     // clear the buffer
     m_buffer->clear();
 
@@ -2937,7 +2920,7 @@
   editEnd();
 }
 
-void KateDocument::insertTab( KateView *view, const KTextEditor::Cursor& c )
+void KateDocument::insertTab( KateView *, const KTextEditor::Cursor& c )
 {
   if (!isReadWrite())
     return;
--- trunk/KDE/kdelibs/kate/document/katedocument.h #1169511:1169512
@@ -44,7 +44,6 @@
 
 #include "katepartprivate_export.h"
 #include "katetextline.h"
-#include "kateedit.h"
 #include "katetextcursor.h"
 #include "katetextrange.h"
 
@@ -65,11 +64,35 @@
 class KateDocumentConfig;
 class KateHighlighting;
 class KateUndoManager;
-class KateEditHistory;
 class KateOnTheFlyChecker;
 
 class KateAutoIndent;
 
+namespace Kate
+{
+  enum EditSource {
+    /// Editing from opening a file
+    OpenFileEdit,
+    /// Editing from closing a file
+    CloseFileEdit,
+    /// Editing performed by the user
+    UserInputEdit,
+    /// Editing performed by the user within an input method context
+    InputMethodContextEdit,
+    /// Editing from cutting, copying and pasting
+    CutCopyPasteEdit,
+    /// Edits from code completion
+    CodeCompletionEdit,
+    /// Editing from a client application, eg. kdevelop.
+    ThirdPartyEdit,
+    /// Other internal editing done by Kate
+    InternalEdit,
+    /// An edit type which means that no edit source was otherwise specified, and \
any preexisting type should be inherited. +    NoEditSource
+  };
+
+}
+
 //
 // Kate KTextEditor::Document class (and even KTextEditor::Editor ;)
 //
@@ -320,11 +343,9 @@
   public:
     uint undoCount () const;
     uint redoCount () const;
-    KateEditHistory* history() const { return m_editHistory; }
 
   protected:
     KateUndoManager* const m_undoManager;
-    KateEditHistory* const m_editHistory;
 
   Q_SIGNALS:
     void undoChanged ();


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

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