// be careful: this is called from the bv's constructor, too, so
// bv functions are not yet available!
Cursor::Cursor(BufferView & bv)
- : CursorData(&bv.buffer()), bv_(&bv),
+ : CursorData(&bv.buffer()), bv_(&bv),
x_target_(-1), textTargetOffset_(0)
{}
if (disp_.dispatched())
break;
}
-
+
// it completely to get a 'bomb early' behaviour in case this
// object will be used again.
if (!disp_.dispatched()) {
// We might have invalidated the cursor when removing an empty
// paragraph while the cursor could not be moved out the inset
// while we initially thought we could. This might happen when
- // a multiline inset becomes an inline inset when the second
+ // a multiline inset becomes an inline inset when the second
// paragraph is removed.
if (safe.pit() > safe.lastpit()) {
safe.pit() = safe.lastpit();
// Are we already at rightmost pos in row?
else if (text()->empty() || right_pos == -1) {
-
+
new_cur = *this;
if (!new_cur.posVisToNewRow(false)) {
LYXERR(Debug::RTL, "not moving!");
return false;
}
-
+
// we actually move the cursor at the end of this
// function, for now just keep track of the new
// position in new_cur...
- LYXERR(Debug::RTL, "right edge, moving: " << int(new_cur.pit()) << ","
+ LYXERR(Debug::RTL, "right edge, moving: " << int(new_cur.pit()) << ","
<< int(new_cur.pos()) << "," << (new_cur.boundary() ? 1 : 0));
}
new_cur.pos() = right_pos;
new_cur.boundary(false);
}
-
+
}
bool moved = (new_cur.pos() != pos()
|| new_cur.pit() != pit()
|| new_cur.boundary() != boundary()
|| &new_cur.inset() != &inset());
-
+
if (moved) {
- LYXERR(Debug::RTL, "moving to: " << new_cur.pos()
+ LYXERR(Debug::RTL, "moving to: " << new_cur.pos()
<< (new_cur.boundary() ? " (boundary)" : ""));
*this = new_cur;
}
// Are we at an inset?
new_cur.pos() = left_pos;
new_cur.boundary(false);
- if (!skip_inset &&
+ if (!skip_inset &&
text()->checkAndActivateInsetVisual(new_cur, left_pos >= pos(), true)) {
// we actually move the cursor at the end of this
// function, for now we just keep track of the new
// Are we already at leftmost pos in row?
else if (text()->empty() || left_pos == -1) {
-
+
new_cur = *this;
if (!new_cur.posVisToNewRow(true)) {
LYXERR(Debug::RTL, "not moving!");
return false;
}
-
+
// we actually move the cursor at the end of this
// function, for now just keep track of the new
// position in new_cur...
- LYXERR(Debug::RTL, "left edge, moving: " << int(new_cur.pit()) << ","
+ LYXERR(Debug::RTL, "left edge, moving: " << int(new_cur.pit()) << ","
<< int(new_cur.pos()) << "," << (new_cur.boundary() ? 1 : 0));
}
new_cur.pos() = left_pos;
new_cur.boundary(false);
}
-
+
}
- bool moved = (new_cur.pos() != pos()
+ bool moved = (new_cur.pos() != pos()
|| new_cur.pit() != pit()
|| new_cur.boundary() != boundary());
if (moved) {
- LYXERR(Debug::RTL, "moving to: " << new_cur.pos()
+ LYXERR(Debug::RTL, "moving to: " << new_cur.pos()
<< (new_cur.boundary() ? " (boundary)" : ""));
*this = new_cur;
}
-
+
return moved;
}
// 1). So we already have one known position around the
// cursor:
pos_type const known_pos = boundary() && pos() > 0 ? pos() - 1 : pos();
-
+
// edge case: if we're at the end of the paragraph, things are
// a little different (because lastpos is a position which
// does not really "exist" --- there's no character there
if (par.isRTL(buf.params())) {
left_pos = -1;
right_pos = bidi.vis2log(row.pos());
- } else {
+ } else {
// LTR paragraph
right_pos = -1;
left_pos = bidi.vis2log(row.endpos() - 1);
}
return;
}
-
+
// Whether 'known_pos' is to the left or to the right of the
// cursor depends on whether it is an RTL or LTR character...
- bool const cur_is_RTL =
+ bool const cur_is_RTL =
par.getFontSettings(buf.params(), known_pos).isVisibleRightToLeft();
// ... in the following manner:
// For an RTL character, "before"
// such a separator could appear visually in the
// middle of a row), set 'left_pos' to the *next*
// position to the left.
- if (bidi.inRange(v_left_pos)
- && bidi.vis2log(v_left_pos) + 1 == row.endpos()
+ if (bidi.inRange(v_left_pos)
+ && bidi.vis2log(v_left_pos) + 1 == row.endpos()
&& row.endpos() < lastpos()
&& par.isSeparator(bidi.vis2log(v_left_pos)))
--v_left_pos;
// If the position we identified as 'right_pos' is a
// "skipped separator", set 'right_pos' to the *next*
// position to the right.
- if (right_pos + 1 == row.endpos() && row.endpos() < lastpos()
+ if (right_pos + 1 == row.endpos() && row.endpos() < lastpos()
&& par.isSeparator(right_pos)) {
pos_type const v_right_pos = bidi.log2vis(right_pos) + 1;
if (!bidi.inRange(v_right_pos))
else
right_pos = bidi.vis2log(v_right_pos);
}
- } else {
+ } else {
// known_pos is on the left
left_pos = known_pos;
// *visual* position of 'right_pos'
// If the position we just identified as 'right_pos'
// is a "skipped separator", set 'right_pos' to the
// *next* position to the right.
- if (bidi.inRange(v_right_pos)
- && bidi.vis2log(v_right_pos) + 1 == row.endpos()
+ if (bidi.inRange(v_right_pos)
+ && bidi.vis2log(v_right_pos) + 1 == row.endpos()
&& row.endpos() < lastpos()
&& par.isSeparator(bidi.vis2log(v_right_pos)))
++v_right_pos;
// calculate the logical position of 'right_pos', if in row
- if (!bidi.inRange(v_right_pos))
+ if (!bidi.inRange(v_right_pos))
right_pos = -1;
else
right_pos = bidi.vis2log(v_right_pos);
// If the position we identified as 'left_pos' is a
// "skipped separator", set 'left_pos' to the *next*
// position to the left.
- if (left_pos + 1 == row.endpos() && row.endpos() < lastpos()
+ if (left_pos + 1 == row.endpos() && row.endpos() < lastpos()
&& par.isSeparator(left_pos)) {
pos_type const v_left_pos = bidi.log2vis(left_pos) - 1;
if (!bidi.inRange(v_left_pos))
par_is_LTR = !(*this)[s].inset().asInsetTabular()->isRightToLeft(*this);
LYXERR(Debug::RTL, "Inside table! par_is_LTR=" << (par_is_LTR ? 1 : 0));
}
-
+
// if moving left in an LTR paragraph or moving right in an
// RTL one, move to previous row
if (par_is_LTR == movingLeft) {
boundary(false);
}
}
-
+
// make sure we're at left-/right-most pos in new row
posVisToRowExtremity(!movingLeft);
}
-void Cursor::posVisToRowExtremity(bool left)
+void Cursor::posVisToRowExtremity(bool left)
{
// prepare bidi tables
Paragraph const & par = paragraph();
// is an inset, then we *do* want to stay to
// the left of it anyway: this is the
// "boundary" which we simulate at insets.
-
+
// Another exception is when row.endpos() is
// 0.
-
+
// do we want to be to the right of pos?
// as explained above, if at last pos in row, stay to the right
bool const right_of_pos = row.endpos() > 0
// Now we know if we want to be to the left or to the right of pos,
// let's make sure we are where we want to be.
- bool const new_pos_is_RTL =
+ bool const new_pos_is_RTL =
par.getFontSettings(buf.params(), pos()).isVisibleRightToLeft();
if (new_pos_is_RTL != right_of_pos) {
boundary(true);
}
}
- } else {
+ } else {
// move to rightmost position
// if this is an LTR paragraph, and we're at the last row in the
// paragraph, move to lastpos
// right of it anyway: this is the "boundary"
// which we simulate at insets. Another
// exception is when row.endpos() is 0.
-
+
// do we want to be to the left of pos?
// as explained above, if at last pos in row, stay to the left,
// unless the last position is the same as the first.
// Now we know if we want to be to the left or to the right of pos,
// let's make sure we are where we want to be.
- bool const new_pos_is_RTL =
+ bool const new_pos_is_RTL =
par.getFontSettings(buf.params(), pos()).isVisibleRightToLeft();
if (new_pos_is_RTL == left_of_pos) {
// LASSERT: There have been several bugs around this code, that seem
// to involve failures to reset the anchor. We can at least not crash
// in release mode by resetting it ourselves.
- LASSERT(anchor_.depth() >= depth(),
+ LASSERT(anchor_.depth() >= depth(),
const_cast<DocIterator &>(anchor_) = *this);
CursorSlice normal = anchor_[depth() - 1];
setSelection(true);
// A selection with no contents is not a selection
// FIXME: doesnt look ok
- if (idx() == normalAnchor().idx() &&
- pit() == normalAnchor().pit() &&
+ if (idx() == normalAnchor().idx() &&
+ pit() == normalAnchor().pit() &&
pos() == normalAnchor().pos())
setSelection(false);
}
// insert remembered selection into first argument of a non-macro
else if (atom.nucleus()->nargs() > 0)
atom.nucleus()->cell(0).append(selection);
-
+
plainInsert(atom);
// finally put the macro argument behind, if needed
else
insert(selection);
}
-
+
return true;
}
else if (inset().asInsetText() && xo - textTargetOffset() != x_target()) {
// In text mode inside the line (not left or right) possibly set a new target_x,
// but only if we are somewhere else than the previous target-offset.
-
+
// We want to keep the x-target on subsequent up/down movements
// that cross beyond the end of short lines. Thus a special
// handling when the cursor is at the end of line: Use the new
push(*const_cast<InsetMathScript*>(p));
idx() = p->idxOfScript(up);
pos() = lastpos();
-
+
// we went in the right direction? Otherwise don't jump into the script
int x;
int y;
return true;
}
}
-
+
// try right
if (pos() != lastpos()) {
InsetMathScript const * p = nextAtom()->asScriptInset();
push(*const_cast<InsetMathScript*>(p));
idx() = p->idxOfScript(up);
pos() = 0;
-
+
// we went in the right direction? Otherwise don't jump into the script
int x;
int y;
}
}
}
-
+
// try to find an inset that knows better then we,
if (inset().idxUpDown(*this, up)) {
//lyxerr << "idxUpDown triggered" << endl;
setCursor(bruteFind2(*this, xo, yo));
return true;
}
-
+
// any improvement going just out of inset?
if (popBackward() && inMathed()) {
//lyxerr << "updown: popBackward succeeded" << endl;
if (up ? ynew < yold : ynew > yold)
return true;
}
-
+
// no success, we are probably at the document top or bottom
operator=(old);
return false;
{
TextMetrics const & tm = bv_->textMetrics(text());
ParagraphMetrics const & pm = tm.parMetrics(pit());
-
+
int row;
if (pos() && boundary())
row = pm.pos2row(pos() - 1);
else
row = pm.pos2row(pos());
-
+
if (up) {
if (pit() == 0 && row == 0)
return true;
// In text mode inside the line (not left or right)
// possibly set a new target_x, but only if we are
// somewhere else than the previous target-offset.
-
+
// We want to keep the x-target on subsequent up/down
// movements that cross beyond the end of short lines.
// Thus a special handling when the cursor is at the
xo = targetX();
} else
xo = targetX();
-
+
// first get the current line
TextMetrics & tm = bv_->textMetrics(text());
ParagraphMetrics const & pm = tm.parMetrics(pit());
row = pm.pos2row(pos() - 1);
else
row = pm.pos2row(pos());
-
+
if (atFirstOrLastRow(up)) {
// Is there a place for the cursor to go ? If yes, we
// can execute the DEPM, otherwise we should keep the
break;
}
- // will a next dispatch follow and if there is a new
+ // will a next dispatch follow and if there is a new
// dispatch will it move the cursor out ?
if (depth() > 1 && valid_destination) {
// The cursor hasn't changed yet. This happens when
- // you e.g. move out of an inset. And to give the
+ // you e.g. move out of an inset. And to give the
// DEPM the possibility of doing something we must
// provide it with two different cursors. (Lgb, vfr)
dummy = *this;
else
tm.editXY(*this, xo, yo + textRow().descent() + 1);
clearSelection();
-
- // This happens when you move out of an inset.
- // And to give the DEPM the possibility of doing
- // something we must provide it with two different
- // cursors. (Lgb)
+
+ // This happens when you move out of an inset.
+ // And to give the DEPM the possibility of doing
+ // something we must provide it with two different
+ // cursors. (Lgb)
Cursor dummy = *this;
if (dummy == old)
++dummy.pos();
if (bv().checkDepm(dummy, old)) {
updateNeeded = true;
- // Make sure that cur gets back whatever happened to dummy (Lgb)
+ // Make sure that cur gets back whatever happened to dummy (Lgb)
operator=(dummy);
}
} else {
forceBufferUpdate();
updateTextTargetOffset();
return true;
-}
+}
void Cursor::handleFont(string const & font)
odocstringstream os;
os << '\n';
// only add blank line if we're not in a ParbreakIsNewline situation
- if (!cur->inset().getLayout().parbreakIsNewline()
+ if (!cur->inset().getLayout().parbreakIsNewline()
&& !cur->paragraph().layout().parbreak_is_newline)
os << '\n';
return os.str();
// The logic here should more or less match to the
// Cursor::setCurrentFont logic, i.e. the cursor height should
// give a hint what will happen if a character is entered.
-
+
// HACK. far from being perfect...
CursorSlice const & sl = innerTextSlice();
Text const & text = *sl.text();
Paragraph const & par = text.getPar(sl.pit());
-
+
// on boundary, so we are really at the character before
pos_type pos = sl.pos();
if (pos > 0 && boundary())
--pos;
-
+
// on space? Take the font before (only for RTL boundary stay)
if (pos > 0) {
TextMetrics const & tm = bv().textMetrics(&text);
if (pos == sl.lastpos()
- || (par.isSeparator(pos)
+ || (par.isSeparator(pos)
&& !tm.isRTLBoundary(sl.pit(), pos)))
--pos;
}
-
+
// get font at the position
Font font = par.getFont(buffer()->params(), pos,
text.outerFont(sl.pit()));
{
bool const broken_cursor = DocIterator::fixIfBroken();
bool const broken_anchor = anchor_.fixIfBroken();
-
+
if (broken_cursor || broken_anchor) {
clearNewWordPosition();
clearSelection();
if (cur[i].inset().notifyCursorEnters(cur))
return true;
}
-
+
return false;
}
Buffer const * master = buffer()->masterBuffer();
master->tocBackend().updateItem(*this);
if (master != buffer() && !master->hasGuiDelegate())
- // In case the master has no gui associated with it,
+ // In case the master has no gui associated with it,
// the TocItem is not updated (part of bug 5699).
buffer()->tocBackend().updateItem(*this);
}
LyXAction::NoUpdate) || singleParUpdate);
bool const last_misspelled = lyxrc.spellcheck_continuously
&& cur.paragraph().isMisspelled(cur.pos(), true);
-
+
FuncCode const act = cmd.action();
switch (act) {
needsUpdate |= cursorTop(cur);
needsUpdate |= cur.selHandle(true);
needsUpdate |= cursorBottom(cur);
- } else
+ } else
cur.undispatched();
cur.screenUpdateFlags(Update::FitCursor);
break;
&& cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
-
+
// we will probably be moving out the inset, so we should execute
- // the depm-mechanism, but only when the cursor has a place to
+ // the depm-mechanism, but only when the cursor has a place to
// go outside this inset, i.e. in a slice above.
- if (cur.depth() > 1 && cur.pos() == cur.lastpos()
+ if (cur.depth() > 1 && cur.pos() == cur.lastpos()
&& cur.pit() == cur.lastpit()) {
- // The cursor hasn't changed yet. To give the
+ // The cursor hasn't changed yet. To give the
// DEPM the possibility of doing something we must
// provide it with two different cursors.
Cursor dummy = cur;
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
// we will probably be moving out the inset, so we should execute
- // the depm-mechanism, but only when the cursor has a place to
+ // the depm-mechanism, but only when the cursor has a place to
// go outside this inset, i.e. in a slice above.
if (cur.depth() > 1 && cur.pos() == 0 && cur.pit() == 0) {
- // The cursor hasn't changed yet. To give the
+ // The cursor hasn't changed yet. To give the
// DEPM the possibility of doing something we must
// provide it with two different cursors.
Cursor dummy = cur;
bool const atFirstOrLastRow = cur.atFirstOrLastRow(up);
if (!atFirstOrLastRow) {
- needsUpdate |= cur.selHandle(select);
+ needsUpdate |= cur.selHandle(select);
cur.selHandle(select);
cur.upDownInText(up, needsUpdate);
needsUpdate |= cur.beforeDispatchCursor().inMathed();
// if the cursor cannot be moved up or down do not remove
// the selection right now, but wait for the next dispatch.
if (select)
- needsUpdate |= cur.selHandle(select);
+ needsUpdate |= cur.selHandle(select);
cur.upDownInText(up, needsUpdate);
cur.undispatched();
}
break;
}
cur.pos() = cur.lastpos();
-
+
needsUpdate |= cur != old_cur;
break;
}
&& cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
-
+
// we will probably be moving out the inset, so we should execute
- // the depm-mechanism, but only when the cursor has a place to
+ // the depm-mechanism, but only when the cursor has a place to
// go outside this inset, i.e. in a slice above.
- if (cur.depth() > 1 && cur.pos() == cur.lastpos()
+ if (cur.depth() > 1 && cur.pos() == cur.lastpos()
&& cur.pit() == cur.lastpit()) {
- // The cursor hasn't changed yet. To give the
+ // The cursor hasn't changed yet. To give the
// DEPM the possibility of doing something we must
// provide it with two different cursors.
Cursor dummy = cur;
case LFUN_WORD_BACKWARD_SELECT:
needsUpdate |= cur.selHandle(cmd.action() == LFUN_WORD_BACKWARD_SELECT);
needsUpdate |= cursorBackwardOneWord(cur);
-
+
if (!needsUpdate && oldTopSlice == cur.top()
&& cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
-
+
// we will probably be moving out the inset, so we should execute
- // the depm-mechanism, but only when the cursor has a place to
+ // the depm-mechanism, but only when the cursor has a place to
// go outside this inset, i.e. in a slice above.
- if (cur.depth() > 1 && cur.pos() == 0
+ if (cur.depth() > 1 && cur.pos() == 0
&& cur.pit() == 0) {
- // The cursor hasn't changed yet. To give the
+ // The cursor hasn't changed yet. To give the
// DEPM the possibility of doing something we must
// provide it with two different cursors.
Cursor dummy = cur;
cur.recordUndoSelection();
pit_type const pit_end = cur.selEnd().pit();
for (pit_type pit = cur.selBegin().pit(); pit <= pit_end; pit++) {
- pars_[pit].insertChar(0, '\t',
+ pars_[pit].insertChar(0, '\t',
bv->buffer().params().trackChanges);
// Update the selection pos to make sure the selection does not
// change as the inserted tab will increase the logical pos.
// Maybe we shouldn't allow tabs within a line, because they
// are not (yet) aligned as one might do expect.
FuncRequest cmd(LFUN_SELF_INSERT, from_ascii("\t"));
- dispatch(cur, cmd);
+ dispatch(cur, cmd);
}
break;
}
if (c == '\t' || c == ' ') {
// remove either 1 tab or 4 spaces.
int const n = (c == ' ' ? 4 : 1);
- for (int i = 0; i < n
+ for (int i = 0; i < n
&& !par.empty() && par.getChar(0) == c; ++i) {
if (cur.pit() == pit)
cur.posBackward();
- if (cur.realAnchor().pit() == pit
+ if (cur.realAnchor().pit() == pit
&& cur.realAnchor().pos() > 0 )
cur.realAnchor().backwardPos();
par.eraseChar(0, tc);
}
cur.finishUndo();
} else {
- // If there is no selection, try to remove a tab or some spaces
+ // If there is no selection, try to remove a tab or some spaces
// before the position of the cursor.
Paragraph & par = paragraphs()[cur.pit()];
pos_type const pos = cur.pos();
-
+
if (pos == 0)
break;
-
+
char_type const c = par.getChar(pos - 1);
cur.recordUndo();
if (c == '\t') {
cur.posBackward();
par.eraseChar(cur.pos(), tc);
} else
- for (int n_spaces = 0;
+ for (int n_spaces = 0;
cur.pos() > 0
- && par.getChar(cur.pos() - 1) == ' '
+ && par.getChar(cur.pos() - 1) == ' '
&& n_spaces < 4;
++n_spaces) {
cur.posBackward();
? from_ascii("Separator") : from_ascii("--Separator--");
lyx::dispatch(FuncRequest(LFUN_LAYOUT, sep));
lyx::dispatch(FuncRequest(LFUN_PARAGRAPH_BREAK, "inverse"));
- if (morecont)
+ if (morecont)
lyx::dispatch(FuncRequest(LFUN_DOWN));
lyx::dispatch(FuncRequest(LFUN_LAYOUT, layout));
--pos;
BufferParams const & bufparams = bv->buffer().params();
- bool const hebrew =
+ bool const hebrew =
par.getFontSettings(bufparams, pos).language()->lang() == "hebrew";
bool const allow_inset_quote = !(par.isPassThru() || hebrew);
dispatch(cur, fr);
break;
}
-
+
case LFUN_NOMENCL_PRINT:
case LFUN_NEWPAGE_INSERT:
// do nothing fancy
case LFUN_APPENDIX:
// FIXME We really should not allow this to be put, e.g.,
- // in a footnote, or in ERT. But it would make sense in a
+ // in a footnote, or in ERT. But it would make sense in a
// branch, so I'm not sure what to do.
flag.setOnOff(cur.paragraph().params().startOfAppendix());
break;
case LFUN_PARAGRAPH_BREAK:
enable = cur.inset().getLayout().isMultiPar();
break;
-
+
case LFUN_SPELLING_ADD:
case LFUN_SPELLING_IGNORE:
case LFUN_SPELLING_REMOVE:
case LFUN_LAYOUT:
enable = !cur.inset().forcePlainLayout();
break;
-
+
case LFUN_ENVIRONMENT_SPLIT: {
// FIXME This hardcoding is bad
if (!cur.buffer()->params().documentClass().hasLayout(from_ascii("Separator"))
}
if (code != NO_CODE
- && (cur.empty()
+ && (cur.empty()
|| !cur.inset().insetAllowed(code)
|| (cur.paragraph().layout().pass_thru && !allow_in_passthru)))
enable = false;
{
FontInfo lf(font_.fontInfo());
lf.reduce(bv_->buffer().params().getFont().fontInfo());
- font.fontInfo().realize(lf);
+ font.fontInfo().realize(lf);
}
// no RTL boundary at line break:
// abc|\n -> move right -> abc\n (and not: abc\n|
// FED FED| FED )
- if (startpos == pos && endpos == pos && endpos != par.size()
- && (par.isNewline(pos - 1)
- || par.isLineSeparator(pos - 1)
+ if (startpos == pos && endpos == pos && endpos != par.size()
+ && (par.isNewline(pos - 1)
+ || par.isLineSeparator(pos - 1)
|| par.isSeparator(pos - 1)))
return false;
-
+
bool left = font.isVisibleRightToLeft();
bool right;
if (pos == par.size())
right = par.isRTL(bv_->buffer().params());
else
right = displayFont(pit, pos).isVisibleRightToLeft();
-
+
return left != right;
}
case LYX_ALIGN_CENTER:
case LYX_ALIGN_LEFT:
case LYX_ALIGN_RIGHT:
- if (align == LYX_ALIGN_NONE
+ if (align == LYX_ALIGN_NONE
|| align == LYX_ALIGN_BLOCK)
align = owner.contentAlignment();
break;
#if 0
-// Not used, see TextMetrics::rowBreakPoint.
+// Not used, see TextMetrics::rowBreakPoint.
// this needs special handling - only newlines count as a break point
static pos_type addressBreakPoint(pos_type i, Paragraph const & par)
{
Layout const & layout = par.layout();
#if 0
- //FIXME: As long as leftMargin() is not correctly implemented for
+ //FIXME: As long as leftMargin() is not correctly implemented for
// MARGIN_RIGHT_ADDRESS_BOX, we should also not do this here.
// Otherwise, long rows will be painted off the screen.
if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX)
ParagraphList const & pars_ = text_->paragraphs();
bool const draw_par_end_marker = lyxrc.paragraph_markers
&& size_type(pit + 1) < pars_.size();
-
+
for ( ; i < end; ++i, ++fi) {
int thiswidth = pm.singleWidth(i, *fi);
-
+
if (draw_par_end_marker && i == end - 1)
// enlarge the last character to hold the end-of-par marker
thiswidth += par_marker_width;
w -= singleWidth(pit, i - 1);
w = max(w, label_end);
}
-
- // a line separator at the end of a line (but not at the end of a
+
+ // a line separator at the end of a line (but not at the end of a
// paragraph) will not be drawn and should therefore not count for
// the row width.
if (!par.isLineSeparator(i) || i != end - 1 || end == par.size())
}
pit_type pit = getPitNearY(y);
LASSERT(pit != -1, return 0);
-
+
int yy = y; // is modified by getPitAndRowNearY
Row const & row = getPitAndRowNearY(yy, pit, assert_in_view, up);
// This should be just before or just behind the
// cursor position set above.
- LASSERT(inset == inset_before
+ LASSERT(inset == inset_before
|| inset == pars[pit].getInset(pos), return 0);
// Make sure the cursor points to the position before
// The left margin depends on the widest row in this paragraph.
// This code is wrong because it depends on the rows, but at the
// same time this function is used in redoParagraph to construct
- // the rows.
+ // the rows.
ParagraphMetrics const & pm = par_metrics_[pit];
RowList::const_iterator rit = pm.rows().begin();
RowList::const_iterator end = pm.rows().end();
&& par.getInset(pos)->display())
&& (!(tclass.isDefaultLayout(par.layout())
|| tclass.isPlainLayout(par.layout()))
- || buffer.params().paragraph_separation
+ || buffer.params().paragraph_separation
== BufferParams::ParagraphIndentSeparation)
)
{
else
l_margin += buffer.params().getIndentation().inPixels(*bv_);
}
-
+
return l_margin;
}
// We store the begin and end pos of the selection relative to this par
DocIterator sel_beg_par = cur.selectionBegin();
DocIterator sel_end_par = cur.selectionEnd();
-
+
// We care only about visible selection.
if (selection) {
if (pit != sel_beg.pit()) {
row.setSelectionAndMargins(sel_beg_par, sel_end_par);
else
row.setSelection(-1, -1);
-
+
// The row knows nothing about the paragraph, so we have to check
// whether this row is the first or last and update the margins.
if (row.selection()) {
pi.pain.fillRectangle(x, y - row.ascent(),
width(), row.height(), pi.background_color);
}
-
+
// Instrumentation for testing row cache (see also
// 12 lines lower):
if (lyxerr.debugging(Debug::PAINTING) && inside