From b158f8a4816789841bef10a7d746ccac0269e89d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Mon, 13 Aug 2001 13:28:14 +0000 Subject: [PATCH] Fixed bug when inserting insets in right alligned paragraphs. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2499 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/insets/ChangeLog | 2 ++ src/insets/inset.C | 11 +++++++---- src/text.C | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5d85b13d83..d8d1cd744e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-08-13 Juergen Vigna + + * text.C (fill): return 0 instead of 20 as this seems to be the more + correct value. + 2001-08-13 Dekel Tsur * encoding.C (TransformChar): Use lyxrc.font_norm_type instead of diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 2a6e14a9bf..2d0df274df 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,5 +1,7 @@ 2001-08-13 Juergen Vigna + * inset.C (getMaxWidth): fixed bug of returning the wrong max width. + * insetcollapsable.C (edit): don't recollapse an already open inset. * insettext.C: fixed problem when reinitializing LyXText by not doing diff --git a/src/insets/inset.C b/src/insets/inset.C index 483d9bea1e..151107a2c4 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -323,11 +323,14 @@ int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const // check for margins left/right and extra right margin "const 5" if ((w - ((2 * TEXT_TO_INSET_OFFSET) + 5)) >= 0) w -= (2 * TEXT_TO_INSET_OFFSET) + 5; - if (topx_set) { + if (topx_set && owner()) { w -= top_x; - if (owner()) { - w += owner()->x(); - } + w += owner()->x(); + } else if (!owner()) { + // give some left margin this should be made better! + // Idea: LyXText::giveLeftMargin(Inset * inset) will search the + // inset in the text and return the LeftMargin of that row! + w -= 20; } if (w < 10) { w = 10; diff --git a/src/text.C b/src/text.C index b374604f4b..feac08041d 100644 --- a/src/text.C +++ b/src/text.C @@ -978,7 +978,7 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const int LyXText::fill(BufferView * bview, Row * row, int paper_width) const { if (paper_width < 0) - return 20; + return 0; int w; // get the pure distance -- 2.39.2