* paragraph.C (startTeXParams, endTeXParams):

reset column count after linebreak.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@16208 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2006-12-08 17:56:47 +00:00
parent 2c746320d2
commit 2a436e855d
2 changed files with 24 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2006-12-08 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* paragraph.C (startTeXParams, endTeXParams):
reset column count after linebreak.
2006-12-04 Gregor Gorjanc <gregor.gorjanc@bfro.uni-lj.si> 2006-12-04 Gregor Gorjanc <gregor.gorjanc@bfro.uni-lj.si>
* paragraph.C (corrected_env, endTeXParams): writeout \begin * paragraph.C (corrected_env, endTeXParams): writeout \begin

View File

@ -55,6 +55,8 @@
using lyx::pos_type; using lyx::pos_type;
using lyx::support::contains;
using lyx::support::rsplit;
using lyx::support::subst; using lyx::support::subst;
using std::distance; using std::distance;
@ -735,6 +737,17 @@ string const corrected_env(string const & suffix, string const & env,
return output; return output;
} }
int adjust_column_count(string const & str, int oldcol)
{
if (!contains(str, "\n"))
return oldcol + str.size();
else {
string tmp;
return rsplit(str, tmp, '\n').size();
}
}
} // namespace anon } // namespace anon
@ -778,7 +791,7 @@ int Paragraph::startTeXParParams(BufferParams const & bparams,
else else
output = corrected_env("\\begin", "flushright", ownerCode()); output = corrected_env("\\begin", "flushright", ownerCode());
os << output; os << output;
column += output.size(); column = adjust_column_count(output, column);
break; break;
} case LYX_ALIGN_RIGHT: { } case LYX_ALIGN_RIGHT: {
string output; string output;
@ -787,13 +800,13 @@ int Paragraph::startTeXParParams(BufferParams const & bparams,
else else
output = corrected_env("\\begin", "flushleft", ownerCode()); output = corrected_env("\\begin", "flushleft", ownerCode());
os << output; os << output;
column += output.size(); column = adjust_column_count(output, column);
break; break;
} case LYX_ALIGN_CENTER: { } case LYX_ALIGN_CENTER: {
string output; string output;
output = corrected_env("\\begin", "center", ownerCode()); output = corrected_env("\\begin", "center", ownerCode());
os << output; os << output;
column += output.size(); column = adjust_column_count(output, column);
break; break;
} }
} }
@ -837,7 +850,7 @@ int Paragraph::endTeXParParams(BufferParams const & bparams,
else else
output = corrected_env("\n\\par\\end", "flushright", ownerCode()); output = corrected_env("\n\\par\\end", "flushright", ownerCode());
os << output; os << output;
column += output.size(); column = adjust_column_count(output, column);
break; break;
} case LYX_ALIGN_RIGHT: { } case LYX_ALIGN_RIGHT: {
string output; string output;
@ -846,13 +859,13 @@ int Paragraph::endTeXParParams(BufferParams const & bparams,
else else
output = corrected_env("\n\\par\\end", "flushleft", ownerCode()); output = corrected_env("\n\\par\\end", "flushleft", ownerCode());
os << output; os << output;
column += output.size(); column = adjust_column_count(output, column);
break; break;
} case LYX_ALIGN_CENTER: { } case LYX_ALIGN_CENTER: {
string output; string output;
output = corrected_env("\n\\par\\end", "center", ownerCode()); output = corrected_env("\n\\par\\end", "center", ownerCode());
os << output; os << output;
column += output.size(); column = adjust_column_count(output, column);
break; break;
} }
} }