From 6953743e22d285e8cd5acb7641c393fbe784ecf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Fri, 22 Feb 2002 13:25:03 +0000 Subject: [PATCH] Fix for #191, setting the cursor to the second paragraph if available if the first one is empty. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3582 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/ChangeLog | 5 +++++ src/insets/insettext.C | 6 +++++- src/tabular_funcs.C | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index db78511f3d..7a27058887 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2002-02-22 Juergen Vigna + + * 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 * insettext.C (getDrawFont): implemented this function to call the diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 0f4823e496..fae47aa4bf 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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); diff --git a/src/tabular_funcs.C b/src/tabular_funcs.C index a9d907f513..7601683be5 100644 --- a/src/tabular_funcs.C +++ b/src/tabular_funcs.C @@ -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;