Various fixes.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_1_6@1339 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-01-15 19:59:54 +00:00
parent 4fd5260241
commit 0adc14a11d
6 changed files with 36 additions and 6 deletions

View File

@ -1,3 +1,13 @@
2001-01-13 Dekel Tsur <dekelts@tau.ac.il>
* src/paragraph.C (SimpleTeXOnePar) Put \protect before paragraph
alignment commands (when needed).
* src/text.C (InsertChar): Add ':' to number separator chars.
Use contains instead of strchr.
* src/mathed/math_draw.C (Metrics): Use the correct GetString.
2001-01-11 Lars Gullik Bjønnes <larsbj@lyx.org>
* release 1.1.6. tagged as lyx-1_1_6 in CVS (in branch

View File

@ -142,7 +142,6 @@ MathParInset::Metrics()
{
byte cx;
byte cxp = 0;
string s;
int ls;
int asc = df_asc;
int des = 0;
@ -163,7 +162,7 @@ MathParInset::Metrics()
while (data.OK()) {
cx = data.GetChar();
if (cx >= ' ') {
s = reinterpret_cast<char *>(data.GetString(ls));
string s = data.GetString();
mathed_string_height(data.FCode(), size, s, asc, des);
if (asc > ascent) ascent = asc;
if (des > descent) descent = des;

View File

@ -2563,6 +2563,8 @@ bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf,
case LYX_ALIGN_SPECIAL:
break;
case LYX_ALIGN_LEFT:
if (moving_arg)
os << "\\protect";
if (getParLanguage(bparams)->babel() != "hebrew") {
os << "\\raggedright ";
column+= 13;
@ -2572,6 +2574,8 @@ bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf,
}
break;
case LYX_ALIGN_RIGHT:
if (moving_arg)
os << "\\protect";
if (getParLanguage(bparams)->babel() != "hebrew") {
os << "\\raggedleft ";
column+= 12;
@ -2581,6 +2585,8 @@ bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf,
}
break;
case LYX_ALIGN_CENTER:
if (moving_arg)
os << "\\protect";
os << "\\centering ";
column+= 11;
break;

View File

@ -344,6 +344,14 @@ bool contains(string const & a, string const & b)
}
bool contains(string const & a, char b)
{
if (a.empty())
return false;
return a.find(b) != string::npos;
}
bool contains(char const * a, char const * b)
{
Assert(a && b);

View File

@ -125,6 +125,9 @@ bool contains(string const & a, char const * b);
///
bool contains(string const & a, string const & b);
///
bool contains(string const & a, char b);
///
bool contains(char const * a, char const * b);

View File

@ -1911,9 +1911,13 @@ void LyXText::InsertChar(BufferView * bview, char c)
if (lyxrc.auto_number) {
static string const number_operators = "+-/*";
static string const number_unary_operators = "+-";
static string const number_seperators = ".,:";
if (current_font.number() == LyXFont::ON) {
if (!isdigit(c) && !strchr("+-/*", c) &&
!(strchr(".,",c) &&
if (!isdigit(c) && !contains(number_operators, c) &&
!(contains(number_seperators, c) &&
cursor.pos() >= 1 &&
cursor.pos() < cursor.par()->size() &&
GetFont(bview->buffer(),
@ -1930,7 +1934,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
if (cursor.pos() > 0) {
char const c = cursor.par()->GetChar(cursor.pos() - 1);
if (strchr("+-",c) &&
if (contains(number_unary_operators, c) &&
(cursor.pos() == 1 ||
cursor.par()->IsSeparator(cursor.pos() - 2) ||
cursor.par()->IsNewline(cursor.pos() - 2) )
@ -1939,7 +1943,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
cursor.par(),
cursor.pos() - 1,
current_font);
} else if (strchr(".,", c) &&
} else if (contains(number_seperators, c) &&
cursor.pos() >= 2 &&
GetFont(bview->buffer(),
cursor.par(),