BOOST_ASSERT(pos >= 0);
LyXLayout_ptr const & layout = pars_[pit].layout();
+#ifdef WITH_WARNINGS
#warning broken?
+#endif
BufferParams const & params = bv()->buffer()->params();
pos_type const body_pos = pars_[pit].beginOfBody();
{
BOOST_ASSERT(this == cur.text());
// special handling of new environment insets
- BufferParams const & params = bv()->buffer()->params();
+ BufferView & bv = cur.bv();
+ BufferParams const & params = bv.buffer()->params();
LyXLayout_ptr const & lyxlayout = params.getLyXTextClass()[layout];
if (lyxlayout->is_environment) {
// move everything in a new environment inset
lyxerr << "setting layout " << layout << endl;
- bv()->owner()->dispatch(FuncRequest(LFUN_HOME));
- bv()->owner()->dispatch(FuncRequest(LFUN_ENDSEL));
- bv()->owner()->dispatch(FuncRequest(LFUN_CUT));
+ bv.owner()->dispatch(FuncRequest(LFUN_HOME));
+ bv.owner()->dispatch(FuncRequest(LFUN_ENDSEL));
+ bv.owner()->dispatch(FuncRequest(LFUN_CUT));
InsetBase * inset = new InsetEnvironment(params, layout);
insertInset(cur, inset);
//inset->edit(cur, true);
- //bv()->owner()->dispatch(FuncRequest(LFUN_PASTE));
+ //bv.owner()->dispatch(FuncRequest(LFUN_PASTE));
return;
}
bool LyXText::changeDepthAllowed(LCursor & cur, DEPTH_CHANGE type) const
{
BOOST_ASSERT(this == cur.text());
- par_type beg, end;
+ par_type beg, end;
getSelectionSpan(cur, beg, end);
int max_depth = 0;
if (beg != 0)
// Update current font
real_current_font.update(font,
- bv()->buffer()->params().language,
+ cur.buffer().params().language,
toggleall);
// Reduce to implicit settings
par_type const beg = cur.selBegin().par();
par_type const end = cur.selEnd().par();
- DocIterator pos = cur.selectionBegin();
- DocIterator posend = cur.selectionEnd();
+ DocIterator pos = cur.selectionBegin();
+ DocIterator posend = cur.selectionEnd();
- BufferParams const & params = bv()->buffer()->params();
+ lyxerr << "pos: " << pos << " posend: " << posend << endl;
+
+ BufferParams const & params = cur.buffer().params();
- for (; pos != posend; pos.forwardChar()) {
- LyXFont f = getFont(pos.par(), pos.pos());
- f.update(font, params.language, toggleall);
- setCharFont(pos.par(), pos.pos(), f);
+ // Don't use forwardChar here as posend might have
+ // pos() == lastpos() and forwardChar would miss it.
+ for (; pos != posend; pos.forwardPos()) {
+ if (pos.pos() != pos.lastpos()) {
+ LyXFont f = getFont(pos.par(), pos.pos());
+ f.update(font, params.language, toggleall);
+ setCharFont(pos.par(), pos.pos(), f);
+ }
}
-
+
redoParagraphs(beg, end + 1);
}
par_type tmppit = pit;
InsetBase * in = 0;
bool isOK = false;
- while (tmppit != end && pars_[tmppit].inInset()
- // the single '=' is intended below
- && (in = pars_[tmppit].inInset()))
- {
+ while (tmppit != end) {
+ in = pars_[tmppit].inInset();
if (in->lyxCode() == InsetBase::FLOAT_CODE ||
in->lyxCode() == InsetBase::WRAP_CODE) {
isOK = true;
bv()->buffer()->params().getLyXTextClass().counters().reset();
bool update_pos = false;
-
+
par_type end = paragraphs().size();
for (par_type pit = 0; pit != end; ++pit) {
string const oldLabel = pars_[pit].params().labelString();
// only to be sure, should not be neccessary
cur.clearSelection();
- bv()->buffer()->insertStringAsLines(pars_, pit, pos, current_font, str);
+ cur.buffer().insertStringAsLines(pars_, pit, pos, current_font, str);
redoParagraphs(cur.par(), endpit);
cur.resetAnchor();
// This shouldn't happen.
BOOST_ASSERT(false);
}
-
+
if (pos < row.pos()) {
lyxerr << "dont like 3 please report pos:" << pos
<< " size: " << para.size()
}
}
- BufferParams const & bufparams = bv()->buffer()->params();
+ BufferParams const & bufparams = cur.buffer().params();
current_font = pars_[pit].getFontSettings(bufparams, pos);
real_current_font = getFont(pit, pos);
if (cur.pos() == cur.lastpos()
- && bidi.isBoundary(*bv()->buffer(), pars_[pit], cur.pos())
+ && bidi.isBoundary(cur.buffer(), pars_[pit], cur.pos())
&& !cur.boundary()) {
Language const * lang = pars_[pit].getParLanguage(bufparams);
current_font.setLanguage(lang);
{
x -= xo_;
RowMetrics const r = computeRowMetrics(pit, row);
-
+
pos_type vc = row.pos();
pos_type end = row.endpos();
pos_type c = 0;
// try to descend into nested insets
InsetBase * inset = checkInsetHit(x, y);
+ lyxerr << "inset " << inset << " hit at x: " << x << " y: " << y << endl;
if (!inset)
return 0;
setCursor(cur, cur.par(), cur.pos() - 1, true, false);
if (!checkAndActivateInset(cur, false)) {
if (false && !boundary &&
- bidi.isBoundary(*bv()->buffer(), cur.paragraph(), cur.pos() + 1))
+ bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos() + 1))
setCursor(cur, cur.par(), cur.pos() + 1, true, true);
- return;
}
+ return;
}
if (cur.par() != 0) {
}
if (cur.pos() != cur.lastpos()) {
- if (!checkAndActivateInset(cur, true)) {
+ if (!checkAndActivateInset(cur, true)) {
setCursor(cur, cur.par(), cur.pos() + 1, true, false);
- if (false && bidi.isBoundary(*bv()->buffer(), cur.paragraph(),
+ if (false && bidi.isBoundary(cur.buffer(), cur.paragraph(),
cur.pos()))
setCursor(cur, cur.par(), cur.pos(), true, true);
}
#endif
// correct all cursor parts
fixCursorAfterDelete(cur.top(), old.top());
- fixCursorAfterDelete(cur.anchor(), old.top());
+#warning DEPM, look here
+ //fixCursorAfterDelete(cur.anchor(), old.top());
return false;
}
}
// such events. Maybe even signal/slot?
if (cur.par() > old.par())
--cur.par();
- if (cur.anchor().par() > old.par())
- --cur.anchor().par();
+#warning DEPM, look here
+// if (cur.anchor().par() > old.par())
+// --cur.anchor().par();
if (selection_position_was_oldcursor_position) {
// correct selection