]> git.lyx.org Git - features.git/commitdiff
Fix for #191, setting the cursor to the second paragraph if available if the
authorJürgen Vigna <jug@sad.it>
Fri, 22 Feb 2002 13:25:03 +0000 (13:25 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 22 Feb 2002 13:25:03 +0000 (13:25 +0000)
first one is empty.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3582 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insettext.C
src/tabular_funcs.C

index db78511f3d77bd6667c9f0b3935928de6de0dc0c..7a27058887c91be6f05edd233a8539c1dc9d8180 100644 (file)
@@ -1,3 +1,8 @@
+2002-02-22  Juergen Vigna  <jug@sad.it>
+
+       * insettext.C (insetUnlock): set the cursor to the second paragraph
+       if available and if the first one is empty (fix #191).
+
 2002-02-20  Juergen Vigna  <jug@sad.it>
 
        * insettext.C (getDrawFont): implemented this function to call the
index 0f4823e496ebe5626024a859c1cb50d5538794f2..fae47aa4bfdc718b00665a641410f1917ce6e5ca 100644 (file)
@@ -753,7 +753,11 @@ void InsetText::insetUnlock(BufferView * bv)
        } else
                bv->owner()->setLayout(bv->text->cursor.par()->getLayout());
        // hack for deleteEmptyParMech
-       lt->setCursor(bv, par, 0);
+       if (par->size()) {
+               lt->setCursor(bv, par, 0);
+       } else if (par->next()) {
+               lt->setCursor(bv, par->next(), 0);
+       }
        if (clear)
                lt = 0;
        updateLocal(bv, code, false);
index a9d907f51384223003badbba950253a65c9114ea..7601683be53fe2913f10a6ac7edffb84f79c5a61 100644 (file)
@@ -30,12 +30,21 @@ using std::getline;
 template <>
 string const write_attribute(string const & name, bool const & b)
 {
+       // we write only true attribute values so we remove a bit of the
+       // file format bloat for tabulars.
+       if (!b)
+               return string();
+       
        return write_attribute(name, int(b));
 }
 
 template <>
 string const write_attribute(string const & name, LyXLength const & value)
 {
+       // we write only the value if we really have one same reson as above.
+       if (value.zero())
+               return string();
+       
        return write_attribute(name, value.asString());
 }
 
@@ -210,6 +219,9 @@ bool getTokenValue(string const & str, const char * token,
 
 bool getTokenValue(string const & str, const char * token, bool & flag)
 {
+       // set the flag always to false as this should be the default for bools
+       // not in the file-format.
+       flag = false;
        string tmp;
        if (!getTokenValue(str, token, tmp))
                return false;
@@ -219,6 +231,9 @@ bool getTokenValue(string const & str, const char * token, bool & flag)
 
 bool getTokenValue(string const & str, const char * token, LyXLength & len)
 {
+       // set the lenght to be zero() as default as this it should be if not
+       // in the file format.
+       len = LyXLength();
        string tmp;
        if (!getTokenValue(str, token, tmp))
                return false;