void BufferView::setCursor(ParIterator const & par, lyx::pos_type pos)
{
- LCursor & cur = cursor();
- cur.setCursor(makeDocumentIterator(par, pos), false);
+ int const last = par.size();
+ for (int i = 0; i < last; ++i)
+ par[i].inset().edit(cursor(), true);
+
+ cursor().setCursor(makeDocumentIterator(par, pos), false);
}
cursor().clearSelection();
- LyXText & text = *par.text();
+ LyXText & text = *cur[0].text();
setCursor(par, cur.pos());
// hack for the chicken and egg problem
top_y(text.getPar(par.outerPar()).y);
update();
- text.setCursor(cursor(), cur.par(), cur.pos());
+ //text.setCursor(cursor(), cur.par(), cur.pos());
cursor().updatePos();
if (length) {
- setSelectionRange(cursor(), length);
- cursor().setSelection();
if (backwards) {
+ cursor().setSelection(cursor(), -length);
DocumentIterator const it = cursor();
- cursor().setCursor(cursor().anchor_, false);
+ cursor().setCursor(cursor().anchor_, true);
cursor().anchor_ = it;
- }
+ } else
+ cursor().setSelection(cursor(), length);
}
fitCursor();
+
+2004-03-31 Alfredo Braunstein <abraunst@lyx.org>
+
+ * BufferView.C (setCursor, putSelectionAt): call edit to open the
+ insets where we are putting the cursor.
+ * ControlSpellchecker.C (isLetter, nextWord): check for inTextEd,
+ use forwardPos.
+
2004-03-31 Angus Leeming <leeming@lyx.org>
* lfuns.h:
bool isLetter(DocumentIterator const & cur)
{
- return !cur.empty()
+ return cur.inTexted()
+ && cur.inset().allowSpellCheck()
+ && cur.pos() != cur.lastpos()
&& cur.paragraph().isLetter(cur.pos())
&& !isDeletedText(cur.paragraph(), cur.pos());
- //&& (!cur.nextInset() || cur.nextInset()->allowSpellCheck());
}
BufferParams & bp)
{
// skip until we have real text (will jump paragraphs)
- for (; cur.size() && !isLetter(cur); cur.forwardChar());
+ for (; cur.size() && !isLetter(cur); cur.forwardPos());
++progress;
// hit end
string str;
// and find the end of the word (insets like optional hyphens
// and ligature break are part of a word)
- for (; cur.size() && isLetter(cur); cur.forwardChar(), ++progress) {
+ for (; cur && isLetter(cur); cur.forwardPos(), ++progress) {
if (!cur.paragraph().isInset(cur.pos()))
str += cur.paragraph().getChar(cur.pos());
}
for (start = 0; it != cur; it.forwardPos())
++start;
- for (total = start; it.size(); it.forwardPos())
+ for (total = start; it; it.forwardPos())
++total;
- for (; cur.size() && isLetter(cur); cur.forwardPos())
+ for (; cur && isLetter(cur); cur.forwardPos())
++start;
while (res == SpellBase::OK || res == SpellBase::IGNORE) {
+2004-03-31 Alfredo Braunstein <abraunst@lyx.org>
+
+ * insettext.C (edit): comment the call to updateLocal (dangling now)
+ * insettext.h: add allowSpellCheck() returning true
+
2004-03-31 Angus Leeming <angus@localhost.localdomain>
* insetcollapsable.[Ch]: (leaveInset): renaming of getOutOfInset.
cur.clearSelection();
finishUndo();
sanitizeEmptyText(cur.bv());
- updateLocal(cur);
+#warning can someone check if/when this is needed?
+//Andre?
+// updateLocal(cur);
}
ParagraphList const & paragraphs() const;
///
bool insetAllowed(Code) const { return true; }
+ ///
+ bool allowSpellCheck() const { return true; }
protected:
///