]> git.lyx.org Git - features.git/commitdiff
small fix to the doublespace handling in deleteemptyparagraphmechanism that might...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 14 Mar 2000 23:33:15 +0000 (23:33 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 14 Mar 2000 23:33:15 +0000 (23:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@606 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/insets/inset.C
src/text.C
src/text2.C

index a284e0eb03cfd88a496e3c10112640559bf97fe6..0007d15b4129ed4b30e759e5cbfc6b0d98cd9100 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-03-15  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/text2.C (DeleteEmptyParagraphMechanism): don't run,
+       RedoParagraphs from the doublespace handling part, just set status
+       to NEED_MORE_REFRESH. Also don't update cursor position (should be
+       done, but perhaps not like this.)
+
 2000-03-14  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * src/text2.C (InsertStringA): don't forget to insert a META_INSET
index 3a1fcb939d2b61266e233c1bf05c4845633d6755..d0da2ce83aa2ef0aa7181257224d6f033c2763b7 100644 (file)
@@ -115,7 +115,7 @@ void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
 
     scx = 0;
 
-    mx_scx=abs((width(bv->getPainter(), font) - bv->paperWidth()) / 2);
+    mx_scx = abs((width(bv->getPainter(), font) - bv->paperWidth()) / 2);
 }
 
 
index ea24cf69f2e8e29262ca89012bee5e65bbc2bfa8..e8cc5e4dd0c7c56d51db3a4f9dda6a3e5dd345c8 100644 (file)
@@ -3292,7 +3292,7 @@ void LyXText::Delete()
 }
 
 
-void  LyXText::Backspace()
+void LyXText::Backspace()
 {
        LyXParagraph * tmppar;
        Row * tmprow, * row;
index fad86fa97064fc268fbe4599a951c35dda906ca5..1aaf90d43ecdddc990cd275766646b8ee4d22727 100644 (file)
@@ -3289,16 +3289,16 @@ void LyXText::CursorDownParagraph() const
 
 void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
 {
-       bool deleted = false;
-       
-       // this is the delete-empty-paragraph-mechanism.
+       // Would be wrong to delete anything if we have a selection.
        if (selection) return;
 
-       // if free-spacing, then return also.
+       // We allow all kinds of "mumbo-jumbo" when freespacing.
        if (textclasslist.Style(parameters->textclass,
                                old_cursor.par->GetLayout()).free_spacing)
                return;
 
+       bool deleted = false;
+       
 #ifdef FIX_DOUBLE_SPACE
        /* Ok I'll put some comments here about what is missing.
           I have fixed BackSpace (and thus Delete) to not delete
@@ -3324,25 +3324,27 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
        // MISSING
 
        // If the pos around the old_cursor were spaces, delete one of them.
-       if (!(old_cursor.par == cursor.par && old_cursor.pos == cursor.pos)
-           && old_cursor.pos > 0
-           && old_cursor.pos < old_cursor.par->Last()
-           && old_cursor.par->IsLineSeparator(old_cursor.pos)
-           && old_cursor.par->IsLineSeparator(old_cursor.pos - 1)) {
-               old_cursor.par->Erase(old_cursor.pos - 1);
-               RedoParagraphs(old_cursor, old_cursor.par->Next());
-               // or RedoDrawingOfParagraph(old_cursor);
-               // correct cursor
-               if (old_cursor.par == cursor.par &&
-                   cursor.pos > old_cursor.pos)
-                       SetCursor(cursor.par, cursor.pos - 1);
-               else
-                       SetCursor(cursor.par, cursor.pos);
-               return;
+       if (old_cursor.par != cursor.par || old_cursor.pos != cursor.pos) { // Only if the cursor has really moved
+               if (old_cursor.pos > 0
+                   && old_cursor.pos < old_cursor.par->Last()
+                   && old_cursor.par->IsLineSeparator(old_cursor.pos)
+                   && old_cursor.par->IsLineSeparator(old_cursor.pos - 1)) {
+                       old_cursor.par->Erase(old_cursor.pos - 1);
+                       //RedoParagraphs(old_cursor, old_cursor.par->Next());
+                       status = LyXText::NEED_MORE_REFRESH;
+                       //deleted = true;
+                       // correct cursor
+                       //if (old_cursor.par == cursor.par &&
+                       //    cursor.pos > old_cursor.pos)
+                       //      SetCursor(cursor.par, cursor.pos - 1);
+                       //else
+                       //      SetCursor(cursor.par, cursor.pos);
+                       //return;
+               }
        }
 #endif
-       //
-       // Paragraph should not be deleted if empty
+#if 1
+       // Do not delete empty paragraphs with keepempty set.
        if ((textclasslist.Style(parameters->textclass,
                                 old_cursor.par->GetLayout())).keepempty)
                return;
@@ -3352,7 +3354,7 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
        if (old_cursor.par != cursor.par) {
                if ( (old_cursor.par->Last() == 0
                      || (old_cursor.par->Last() == 1
-                         && (old_cursor.par->IsLineSeparator(0))))
+                         && old_cursor.par->IsLineSeparator(0)))
                     && old_cursor.par->FirstPhysicalPar()
                     == old_cursor.par->LastPhysicalPar()) {
                        
@@ -3364,13 +3366,11 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                               && old_cursor.row->previous->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
                             && !(old_cursor.row->next 
                                  && old_cursor.row->next->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE))
-                           || 
-                           (old_cursor.par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE &&
-                            ((old_cursor.row->previous 
-                              && old_cursor.row->previous->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
-                             || 
-                             (old_cursor.row->next
-                              && old_cursor.row->next->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE))
+                           || (old_cursor.par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE &&
+                               ((old_cursor.row->previous 
+                                 && old_cursor.row->previous->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
+                                || (old_cursor.row->next
+                                    && old_cursor.row->next->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE))
                                    )) {
                                status = LyXText::NEED_MORE_REFRESH;
                                deleted = true;
@@ -3468,6 +3468,7 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                        }
                }
        }
+#endif
 }