&& ! row->par()->isFirstInSequence()))
&& align == LYX_ALIGN_BLOCK
&& !row->par()->params().noindent()
- // in tabulars paragraphs are never indented!
- && (!row->par()->inInset() || row->par()->inInset()->owner()->lyxCode() != Inset::TABULAR_CODE)
+ // in tabulars and ert paragraphs are never indented!
+ && (!row->par()->inInset() || !row->par()->inInset()->owner() ||
+ (row->par()->inInset()->owner()->lyxCode() != Inset::TABULAR_CODE &&
+ row->par()->inInset()->owner()->lyxCode() != Inset::ERT_CODE))
&& (row->par()->layout() != tclass.defaultLayoutName() ||
bview->buffer()->params.paragraph_separation ==
BufferParams::PARSEP_INDENT)) {
void LyXText::breakParagraph(BufferView * bview, char keep_layout)
{
- LyXLayout const & layout =
- textclasslist[bview->buffer()->params.textclass][cursor.par()->layout()];
+ LyXTextClass const & tclass =
+ textclasslist[bview->buffer()->params.textclass];
+ LyXLayout const & layout = tclass[cursor.par()->layout()];
// this is only allowed, if the current paragraph is not empty or caption
if ((cursor.par()->size() <= 0)
if (layout.labeltype == LABEL_SENSITIVE) {
if (!cursor.pos())
// set to standard-layout
- cursor.par()->applyLayout(0);
+ cursor.par()->applyLayout(tclass.defaultLayoutName());
else
// set to standard-layout
- cursor.par()->next()->applyLayout(0);
+ cursor.par()->next()->applyLayout(tclass.defaultLayoutName());
}
/* if the cursor is at the beginning of a row without prior newline,
textclasslist[bview->buffer()->params.textclass][cursor.row()->par()->layout()].free_spacing ||
cursor.row()->par()->isFreeSpacing();
-
if (lyxrc.auto_number) {
static string const number_operators = "+-/*";
static string const number_unary_operators = "+-";
Row * row = cursor.row();
int y = cursor.y() - row->baseline();
if (c != Paragraph::META_INSET) /* Here case LyXText::InsertInset
- * already insertet the character */
+ * already insertet the character */
cursor.par()->insertChar(cursor.pos(), c);
setCharFont(bview->buffer(), cursor.par(), cursor.pos(), rawtmpfont);
|| ((cursor.pos() < cursor.par()->size()) &&
cursor.par()->isInset(cursor.pos()+1))
|| cursor.row()->fill() == -1)
- && row->previous() && row->previous()->par() == row->par()) {
+ && row->previous() && row->previous()->par() == row->par())
+ {
pos_type z = nextBreakPoint(bview,
row->previous(),
workWidth(bview));
// recalculate the fill of the row
if (row->fill() >= 0) /* needed because a newline
- * will set fill to -1. Otherwise
- * we would not get a rebreak! */
+ * will set fill to -1. Otherwise
+ * we would not get a rebreak! */
row->fill(fill(bview, row, workWidth(bview)));
if (row->fill() < 0) {
refresh_y = y;
&& (inset->display())) // || (inset->scroll() < 0)))
align = (inset->lyxCode() == Inset::MATHMACRO_CODE)
? LYX_ALIGN_BLOCK : LYX_ALIGN_CENTER;
+ // ERT insets should always be LEFT ALIGNED on screen
+ inset = row->par()->inInset();
+ if (inset && inset->owner() &&
+ inset->owner()->lyxCode() == Inset::ERT_CODE)
+ {
+ align = LYX_ALIGN_LEFT;
+ }
switch (align) {
case LYX_ALIGN_BLOCK:
Row * LyXText::getRowNearY(int & y) const
{
+#if 1
// If possible we should optimize this method. (Lgb)
Row * tmprow = firstrow;
int tmpy = 0;
}
y = tmpy; // return the real y
+
+ //lyxerr << "returned y = " << y << endl;
+
return tmprow;
+#else
+ // Search from the current cursor position.
+
+ Row * tmprow = cursor.row();
+ int tmpy = cursor.y() - tmprow->baseline();
+
+ lyxerr << "cursor.y() = " << tmpy << endl;
+ lyxerr << "tmprow->height() = " << tmprow->height() << endl;
+ lyxerr << "tmprow->baseline() = " << tmprow->baseline() << endl;
+ lyxerr << "first = " << first << endl;
+ lyxerr << "y = " << y << endl;
+
+ if (y < tmpy) {
+ lyxerr << "up" << endl;
+#if 0
+ while (tmprow && tmpy - tmprow->height() >= y) {
+ tmpy -= tmprow->height();
+ tmprow = tmprow->previous();
+ }
+#else
+ do {
+ tmpy -= tmprow->height();
+ tmprow = tmprow->previous();
+ } while (tmprow && tmpy - tmprow->height() >= y);
+#endif
+ } else if (y > tmpy) {
+ lyxerr << "down" << endl;
+
+ while (tmprow->next() && tmpy + tmprow->height() <= y) {
+ tmpy += tmprow->height();
+ tmprow = tmprow->next();
+ }
+ } else {
+ lyxerr << "equal" << endl;
+ }
+
+ y = tmpy; // return the real y
+
+ lyxerr << "returned y = " << y << endl;
+
+ return tmprow;
+
+#endif
}