}
+int LyXText::GetRealCursorX(BufferView * bview) const
+{
+ int x = cursor.x();
+ if (the_locking_inset && (the_locking_inset->getLyXText(bview)!=this))
+ x = the_locking_inset->getLyXText(bview)->GetRealCursorX(bview);
+ return x;
+}
+
+
unsigned char LyXText::TransformChar(unsigned char c, LyXParagraph * par,
LyXParagraph::size_type pos) const
{
#endif
);
- // please break always behind a space
+ // Always break behind a space
+ //
+ // It is better to erase the space (Dekel)
if (cursor.pos() < cursor.par()->Last()
&& cursor.par()->IsLineSeparator(cursor.pos()))
- cursor.pos(cursor.pos() + 1);
-
+ cursor.par()->Erase(cursor.pos());
+ // cursor.pos(cursor.pos() + 1);
+
// break the paragraph
if (keep_layout)
keep_layout = 2;
bool const is_rtl =
row->par()->isRightToLeftPar(bview->buffer()->params);
-#ifndef NEW_INSETS
-
if (is_rtl) {
- x = RightMargin(bview->buffer(), row);
+ x = (workWidth(bview) > 0)
+ ? RightMargin(bview->buffer(), row) : 0;
+#ifndef NEW_INSETS
if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
LyXFont font(LyXFont::ALL_SANE);
font.setSize(LyXFont::SIZE_SMALL);
x += lyxfont::width("Mwide-figM", font);
}
- } else
#endif
- if (workWidth(bview) > 0)
- x = LeftMargin(bview, row);
- else
- x = 0;
+ } else
+ x = (workWidth(bview) > 0) ? LeftMargin(bview, row) : 0;
// is there a manual margin with a manual label
if (textclasslist.Style(bview->buffer()->params.textclass,
SetCursor(bview, cursor.par(), cursor.pos() );
// finally set the selection
- SetSelection();
+ SetSelection(bview);
}
SetCursor(bview, cursor.par(), cursor.pos());
// finally set the selection
- SetSelection();
+ SetSelection(bview);
}
SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
- SetSelection();
+ SetSelection(bview);
/* -----> Great, CutSelection() gets rid of multiple spaces. */
CutSelection(bview);
SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
- SetSelection();
+ SetSelection(bview);
CutSelection(bview);
}
}
SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
- SetSelection();
+ SetSelection(bview);
// What is this test for ??? (JMarc)
if (!selection) {
DeleteWordForward(bview);
if (cursor.pos() < cursor.par()->Last() && !cursor.par()->IsSeparator(cursor.pos())) {
cursor.par()->InsertChar(cursor.pos(), ' ');
+ SetCharFont(bview->buffer(), cursor.par(),
+ cursor.pos(), current_font);
// refresh the positions
tmprow = row;
while (tmprow->next() && tmprow->next()->par() == row->par()) {
#warning Should be fixed with a lyxinset::clear_width(bv, font) function! (Jug)
#warning Should we not fix this in the Painter, please have a look Lars! (Jug)
#endif
- int w = (inset_owner ? inset_owner->width(bview, font)-2 : ww);
- int h = row_ptr->height();
- int x = x_offset;
- int y = y_offset;
- if (y < 0) {
- h += y;
- y = 0;
- }
-
+ int const y = y_offset < 0 ? 0 : y_offset;
+ int const h = y_offset < 0 ?
+ row_ptr->height() + y_offset : row_ptr->height();
+ int const w = inset_owner ?
+ inset_owner->width(bview, font) - 2 : ww;
+ int const x = x_offset;
pain.fillRectangle(x, y, w, h);
} else if (inset != 0) {
int h = row_ptr->baseline() - inset->ascent(bview, font);
sel_start_cursor.pos() <= pos) &&
(sel_end_cursor.row() != row_ptr ||
pos < sel_end_cursor.pos()) )
- pain.fillRectangle(x_offset + int(old_tmpx),
+ /// Here we do not use x_offset as x_offset was
+ // added to x.
+ pain.fillRectangle(int(old_tmpx),
y_offset,
int(tmpx - old_tmpx + 1),
row_ptr->height(),