&& ! 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)
&& layout.labeltype!= LABEL_SENSITIVE)
return;
- setUndo(bview, Undo::INSERT,cursor.par(),cursor.par()->next());
+ setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next());
// Always break behind a space
//
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,
* same Paragraph one to the right and make a rebreak */
void LyXText::insertChar(BufferView * bview, char c)
{
- setUndo(bview, Undo::INSERT,
- cursor.par(), cursor.par()->next());
+ setUndo(bview, Undo::INSERT, cursor.par(), cursor.par()->next());
// When the free-spacing option is set for the current layout,
// disable the double-space checking
&& (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:
{
lyx::Assert(from <= to);
- setUndo(bview, Undo::FINISH,
- from.par(), to.par()->next());
+ setUndo(bview, Undo::FINISH, from.par(), to.par()->next());
pos_type pos = from.pos();
Paragraph * par = from.par();
{
Paragraph * tmppar = cursor.par();
- setUndo(&bview, Undo::FINISH,
- tmppar, tmppar->next());
+ setUndo(&bview, Undo::FINISH, tmppar, tmppar->next());
pos_type tmppos = cursor.pos();
// to make sure undo gets the right cursor position
cursor = old_cursor;
setUndo(bview, Undo::DELETE,
- cursor.par(), cursor.par()->next());
+ cursor.par(), cursor.par()->next());
cursor = tmpcursor;
backspace(bview);
}