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
This commit is contained in:
Jürgen Vigna 2002-02-22 13:25:03 +00:00
parent 5539328a35
commit 6953743e22
3 changed files with 25 additions and 1 deletions

View 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

View 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);

View 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;