#include "support/convert.h"
#include "support/debug.h"
#include "support/docstream.h"
+#include "support/FileName.h"
#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h"
}
-bool findChange(DocIterator & cur, bool next)
-{
- if (!next)
- cur.backwardPos();
- for (; cur; next ? cur.forwardPos() : cur.backwardPos())
- if (cur.inTexted() && cur.paragraph().isChanged(cur.pos())) {
- if (!next)
- // if we search backwards, take a step forward
- // to correctly set the anchor
- cur.forwardPos();
- return true;
- }
-
- return false;
-}
-
-
bool searchAllowed(docstring const & str)
{
if (str.empty()) {
}
-bool findNextChange(BufferView * bv)
+namespace {
+bool findChange(DocIterator & cur, bool next)
{
- return findChange(bv, true);
-}
-
+ if (!next)
+ cur.backwardPos();
+ for (; cur; next ? cur.forwardPos() : cur.backwardPos())
+ if (cur.inTexted() && cur.paragraph().isChanged(cur.pos())) {
+ if (!next)
+ // if we search backwards, take a step forward
+ // to correctly set the anchor
+ cur.forwardPos();
+ return true;
+ }
-bool findPreviousChange(BufferView * bv)
-{
- return findChange(bv, false);
+ return false;
}
Change orig_change = tip.paragraph().lookupChange(tip.pos());
if (next) {
- for (; !tip.at_end(); tip.forwardPos()) {
+ for (; tip.pit() < tip.lastpit() || tip.pos() < tip.lastpos(); tip.forwardPos()) {
Change change = tip.paragraph().lookupChange(tip.pos());
if (!change.isSimilarTo(orig_change))
break;
}
} else {
- for (; !tip.at_begin();) {
+ for (; tip.pit() > 0 || tip.pos() > 0;) {
tip.backwardPos();
Change change = tip.paragraph().lookupChange(tip.pos());
if (!change.isSimilarTo(orig_change)) {
return true;
}
+}
+
+
+bool findNextChange(BufferView * bv)
+{
+ return findChange(bv, true);
+}
+
+
+bool findPreviousChange(BufferView * bv)
+{
+ return findChange(bv, false);
+}
+
namespace {