mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
skip ert on spellchecking
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8060 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2ad9bd1e7d
commit
8aaf803192
@ -1,3 +1,9 @@
|
||||
2003-11-07 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* PosIterator.[Ch]: replace the stack with a vector, add inset
|
||||
accesor
|
||||
* iterators.[C]: adjust
|
||||
|
||||
2003-11-06 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* lyxfind.C (replaceAll): mark the buffer dirty if something was
|
||||
|
@ -30,7 +30,7 @@ PosIterator & PosIterator::operator++()
|
||||
{
|
||||
BOOST_ASSERT(!stack_.empty());
|
||||
while (true) {
|
||||
PosIteratorItem & p = stack_.top();
|
||||
PosIteratorItem & p = stack_.back();
|
||||
|
||||
if (p.pos < p.pit->size()) {
|
||||
InsetOld * inset = p.pit->getInset(p.pos);
|
||||
@ -38,7 +38,7 @@ PosIterator & PosIterator::operator++()
|
||||
ParagraphList * pl = inset->getParagraphs(p.index);
|
||||
if (pl) {
|
||||
p.index++;
|
||||
stack_.push(PosIteratorItem(pl, pl->begin(), 0));
|
||||
stack_.push_back(PosIteratorItem(pl, pl->begin(), 0));
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
@ -52,7 +52,7 @@ PosIterator & PosIterator::operator++()
|
||||
if (p.pit != p.pl->end() || stack_.size() == 1)
|
||||
return *this;
|
||||
|
||||
stack_.pop();
|
||||
stack_.pop_back();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -64,7 +64,7 @@ PosIterator & PosIterator::operator--()
|
||||
|
||||
// try to go one position backwards: if on the start of the
|
||||
// ParagraphList, pops an item
|
||||
PosIteratorItem & p = stack_.top();
|
||||
PosIteratorItem & p = stack_.back();
|
||||
if (p.pos > 0) {
|
||||
--p.pos;
|
||||
InsetOld * inset = p.pit->getInset(p.pos);
|
||||
@ -74,22 +74,22 @@ PosIterator & PosIterator::operator--()
|
||||
if (p.pit == p.pl->begin()) {
|
||||
if (stack_.size() == 1)
|
||||
return *this;
|
||||
stack_.pop();
|
||||
--stack_.top().index;
|
||||
stack_.pop_back();
|
||||
--stack_.back().index;
|
||||
} else {
|
||||
--p.pit;
|
||||
p.pos = p.pit->size();
|
||||
}
|
||||
}
|
||||
// try to push an item if there is some left unexplored
|
||||
PosIteratorItem & q = stack_.top();
|
||||
PosIteratorItem & q = stack_.back();
|
||||
if (q.pos < q.pit->size()) {
|
||||
InsetOld * inset = q.pit->getInset(q.pos);
|
||||
if (inset && q.index > 0) {
|
||||
ParagraphList *
|
||||
pl = inset->getParagraphs(q.index - 1);
|
||||
BOOST_ASSERT(pl);
|
||||
stack_.push(PosIteratorItem(pl, prior(pl->end()), pl->back().size()));
|
||||
stack_.push_back(PosIteratorItem(pl, prior(pl->end()), pl->back().size()));
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
@ -105,8 +105,8 @@ bool operator!=(PosIterator const & lhs, PosIterator const & rhs)
|
||||
bool operator==(PosIterator const & lhs, PosIterator const & rhs)
|
||||
{
|
||||
|
||||
PosIteratorItem const & li = lhs.stack_.top();
|
||||
PosIteratorItem const & ri = rhs.stack_.top();
|
||||
PosIteratorItem const & li = lhs.stack_.back();
|
||||
PosIteratorItem const & ri = rhs.stack_.back();
|
||||
|
||||
return (li.pl == ri.pl && li.pit == ri.pit &&
|
||||
(li.pit == li.pl->end() || li.pos == ri.pos));
|
||||
@ -122,7 +122,7 @@ bool PosIterator::at_end() const
|
||||
PosIterator::PosIterator(ParagraphList * pl, ParagraphList::iterator pit,
|
||||
lyx::pos_type pos)
|
||||
{
|
||||
stack_.push(PosIteratorItem(pl, pit, pos));
|
||||
stack_.push_back(PosIteratorItem(pl, pit, pos));
|
||||
}
|
||||
|
||||
|
||||
@ -143,6 +143,15 @@ PosIterator::PosIterator(BufferView & bv)
|
||||
}
|
||||
|
||||
|
||||
InsetOld * PosIterator::inset() const
|
||||
{
|
||||
if (stack_.size() == 1)
|
||||
return 0;
|
||||
PosIteratorItem const & pi = stack_[stack_.size() - 2];
|
||||
return pi.pit->getInset(pi.pos);
|
||||
}
|
||||
|
||||
|
||||
int distance(PosIterator const & cur, PosIterator const & end)
|
||||
{
|
||||
PosIterator p = cur;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "support/types.h"
|
||||
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class BufferView;
|
||||
@ -48,15 +48,17 @@ public:
|
||||
PosIterator & operator--();
|
||||
friend bool operator==(PosIterator const &, PosIterator const &);
|
||||
|
||||
ParagraphList::iterator pit() const { return stack_.top().pit; }
|
||||
lyx::pos_type pos() const { return stack_.top().pos; }
|
||||
ParagraphList::iterator pit() const { return stack_.back().pit; }
|
||||
lyx::pos_type pos() const { return stack_.back().pos; }
|
||||
bool at_end() const;
|
||||
InsetOld * inset() const;
|
||||
friend PosIterator ParIterator::asPosIterator(lyx::pos_type) const;
|
||||
friend ParIterator::ParIterator(PosIterator const &);
|
||||
|
||||
private:
|
||||
PosIterator() {};
|
||||
std::stack<PosIteratorItem> stack_;
|
||||
//this is conceptually a stack, but we need random access sometimes
|
||||
std::vector<PosIteratorItem> stack_;
|
||||
};
|
||||
|
||||
bool operator!=(PosIterator const &, PosIterator const &);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-11-07 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* ControlSpellchecker.C (isLetter): skip ert
|
||||
|
||||
2003-11-06 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* ControlErrorList.C (goTo): allow going to inner paragraphs
|
||||
|
@ -153,7 +153,8 @@ bool isLetter(PosIterator & cur)
|
||||
{
|
||||
return !cur.at_end()
|
||||
&& cur.pit()->isLetter(cur.pos())
|
||||
&& !isDeletedText(*cur.pit(), cur.pos());
|
||||
&& !isDeletedText(*cur.pit(), cur.pos())
|
||||
&& (!cur.inset() || cur.inset()->allowSpellCheck());
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +175,6 @@ WordLangTuple nextWord(PosIterator & cur, PosIterator const & end,
|
||||
if (!cur.pit()->isInset(cur.pos()))
|
||||
str += cur.pit()->getChar(cur.pos());
|
||||
}
|
||||
|
||||
|
||||
return WordLangTuple(str, lang_code);
|
||||
}
|
||||
@ -201,7 +201,6 @@ void ControlSpellchecker::check()
|
||||
if (cur != buffer()->pos_iterator_begin())
|
||||
for (; cur != end && isLetter(cur); ++cur, ++start);
|
||||
|
||||
|
||||
while (res == SpellBase::OK || res == SpellBase::IGNORE) {
|
||||
word_ = nextWord(cur, end, start, buffer()->params());
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-11-07 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* inset.h (allowSpellCheck): add (return true)
|
||||
* insetert.h (allowSpellCheck): add (return false)
|
||||
|
||||
2003-11-05 José Matos <jamatos@lyx.org>
|
||||
|
||||
* inset.h:
|
||||
|
@ -284,6 +284,9 @@ public:
|
||||
/// mark the inset contents as erased (for change tracking)
|
||||
virtual void markErased() {}
|
||||
|
||||
/// does this inset allows spellchecking?
|
||||
virtual bool allowSpellCheck() const { return true; }
|
||||
|
||||
/** Adds a LaTeX snippet to the Preview Loader for transformation
|
||||
* into a bitmap image. Does not start the laoding process.
|
||||
*
|
||||
|
@ -133,6 +133,8 @@ private:
|
||||
void updateStatus(BufferView *, bool = false) const;
|
||||
///
|
||||
void edit(BufferView * bv, bool left);
|
||||
///
|
||||
bool allowSpellCheck() const { return false; }
|
||||
|
||||
///
|
||||
mutable ERTStatus status_;
|
||||
|
@ -354,11 +354,10 @@ PosIterator ParIterator::asPosIterator(lyx::pos_type pos) const
|
||||
int const last = size() - 1;
|
||||
for (int i = 0; i < last; ++i) {
|
||||
ParPosition & pp = pimpl_->positions[i];
|
||||
p.stack_.push(PosIteratorItem(const_cast<ParagraphList *>(pp.plist), pp.pit, (*pp.it)->pos, *pp.index + 1));
|
||||
p.stack_.push_back(PosIteratorItem(const_cast<ParagraphList *>(pp.plist), pp.pit, (*pp.it)->pos, *pp.index + 1));
|
||||
}
|
||||
ParPosition const & pp = pimpl_->positions[last];
|
||||
p.stack_.push(PosIteratorItem(const_cast<ParagraphList *>(pp.plist),
|
||||
pp.pit, pos, 0));
|
||||
p.stack_.push_back(PosIteratorItem(const_cast<ParagraphList *>(pp.plist), pp.pit, pos, 0));
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -366,24 +365,21 @@ PosIterator ParIterator::asPosIterator(lyx::pos_type pos) const
|
||||
ParIterator::ParIterator(PosIterator const & pos)
|
||||
: pimpl_(new Pimpl)
|
||||
{
|
||||
PosIterator copy = pos;
|
||||
int const size = copy.stack_.size();
|
||||
int const size = pos.stack_.size();
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
PosIteratorItem & it = copy.stack_.top();
|
||||
PosIteratorItem const & it = pos.stack_[i];
|
||||
ParPosition pp(it.pit, *it.pl);
|
||||
if (i > 0) {
|
||||
if (i < size - 1) {
|
||||
InsetOld * inset = it.pit->getInset(it.pos);
|
||||
BOOST_ASSERT(inset);
|
||||
InsetList::iterator beg = it.pit->insetlist.begin();
|
||||
InsetList::iterator end = it.pit->insetlist.end();
|
||||
for (; beg != end && beg->inset != inset; ++beg);
|
||||
BOOST_ASSERT(beg != end);
|
||||
pp.it.reset(beg);
|
||||
pp.index.reset(it.index - 1);
|
||||
}
|
||||
pimpl_->positions.insert(pimpl_->positions.begin(), pp);
|
||||
copy.stack_.pop();
|
||||
pimpl_->positions.push_back(pp);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user