From: Lars Gullik Bjønnes Date: Tue, 14 Mar 2000 23:33:15 +0000 (+0000) Subject: small fix to the doublespace handling in deleteemptyparagraphmechanism that might... X-Git-Tag: 1.6.10~22336 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=21f39faddeac4ee869bdf824998ab9572ab640ef;p=features.git small fix to the doublespace handling in deleteemptyparagraphmechanism that might help a bit git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@606 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index a284e0eb03..0007d15b41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-03-15 Lars Gullik Bjønnes + + * 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 * src/text2.C (InsertStringA): don't forget to insert a META_INSET diff --git a/src/insets/inset.C b/src/insets/inset.C index 3a1fcb939d..d0da2ce83a 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -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); } diff --git a/src/text.C b/src/text.C index ea24cf69f2..e8cc5e4dd0 100644 --- a/src/text.C +++ b/src/text.C @@ -3292,7 +3292,7 @@ void LyXText::Delete() } -void LyXText::Backspace() +void LyXText::Backspace() { LyXParagraph * tmppar; Row * tmprow, * row; diff --git a/src/text2.C b/src/text2.C index fad86fa970..1aaf90d43e 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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 }