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

List:       kde-commits
Subject:    kdelibs/kate
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2005-03-12 21:06:18
Message-ID: 20050312210618.793D517B90 () office ! kde ! org
[Download RAW message or body]

CVS commit by cullmann: 

crash fix
can somebody test and backport?
CCMAIL: kwrite-devel@kde.org


  M +12 -1     part/katedocument.cpp   1.798
  M +13 -1     part/katejscript.cpp   1.7
  M +4 -1      scripts/test.js   1.2


--- kdelibs/kate/part/katedocument.cpp  #1.797:1.798
@@ -3317,6 +3317,10 @@ void KateDocument::backspace( const Kate
     {
       // backspace indents: erase to next indent position
-
       KateTextLine::Ptr textLine = m_buffer->plainLine(line);
+
+      // don't forget this check!!!! really!!!!
+      if (!textLine)
+        return;
+
       int colX = textLine->cursorX(col, config()->tabWidth());
       int pos = textLine->firstChar();
@@ -3331,5 +3335,7 @@ void KateDocument::backspace( const Kate
         while (--y >= 0)
         {
+          // this is save, y <= line, and line was already success
           textLine = m_buffer->plainLine(y);
+
           pos = textLine->firstChar();
 
@@ -3359,4 +3365,9 @@ void KateDocument::backspace( const Kate
     {
       KateTextLine::Ptr textLine = m_buffer->plainLine(line-1);
+
+      // don't forget this check!!!! really!!!!
+      if (!textLine)
+        return;
+
       if (config()->wordWrap() && textLine->endingWith(QString::fromLatin1(" ")))
       {

--- kdelibs/kate/part/katejscript.cpp  #1.6:1.7
@@ -80,5 +80,7 @@ public:
          RemoveText,
          InsertLine,
-         RemoveLine
+         RemoveLine,
+         EditBegin,
+         EditEnd
   };
 
@@ -153,4 +155,6 @@ bool KateJScript::execute (KateDocument 
   insertLine     KateJSDocument::InsertLine    DontDelete|Function 2
   removeLine     KateJSDocument::RemoveLine    DontDelete|Function 1
+  editBegin      KateJSDocument::EditBegin     DontDelete|Function 0
+  editEnd        KateJSDocument::EditEnd       DontDelete|Function 0
 @end
 */
@@ -208,4 +212,12 @@ Value KateJSDocumentProtoFunc::call(KJS:
     case KateJSDocument::RemoveLine:
       return KJS::Boolean (doc->removeLine (args[0].toUInt32(exec)));
+
+    case KateJSDocument::EditBegin:
+      doc->editBegin();
+      return KJS::Null ();
+
+    case KateJSDocument::EditEnd:
+      doc->editEnd ();
+      return KJS::Null ();
   }
 

--- kdelibs/kate/scripts/test.js  #1.1:1.2
@@ -3,7 +3,10 @@
 $start = document.numLines ()
 
-for ($t = 0; $t < 10; $t++)
+document.editBegin();
+for ($t = 0; $t < 1000; $t++)
 {
   document.insertLine ($start+$t, document.lineLength(0));
   document.insertText ($start+$t, 1, "muh");
 }
+document.editEnd();
+


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

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