I want to remove the 'feature' of an unsuccessful search leaving the cursor
at the end of the document. This patch seems to achieve it (removing ~10
lines of code). I've somehow tested it, but as I don't know why it was
there on the first place, I'm probably missing something.
Alfredo
Index: lyxfind.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyxfind.C,v
retrieving revision 1.31
diff -u -r1.31 lyxfind.C
--- lyxfind.C 2002/08/08 21:08:02 1.31
+++ lyxfind.C 2002/12/12 11:31:43
@@ -226,7 +226,6 @@
{
Paragraph * par = text->cursor.par();
pos_type pos = text->cursor.pos();
- Paragraph * prev_par = par;
UpdatableInset * inset;
while (par && !IsStringInText(par, pos, str, cs, mw)) {
@@ -246,7 +245,6 @@
++pos;
if (pos >= par->size()) {
- prev_par = par;
par = par->next();
pos = 0;
}
@@ -256,9 +254,6 @@
text->setCursor(bv, par, pos);
return SR_FOUND;
} else {
- // make sure we end up at the end of the text,
- // not the start point of the last search
- text->setCursor(bv, prev_par, prev_par->size());
return SR_NOT_FOUND;
}
}
@@ -273,13 +268,11 @@
{
Paragraph * par = text->cursor.par();
pos_type pos = text->cursor.pos();
- Paragraph * prev_par = par;
do {
if (pos > 0)
--pos;
else {
- prev_par = par;
// We skip empty paragraphs (Asger)
do {
par = par->previous();
@@ -306,8 +299,6 @@
text->setCursor(bv, par, pos);
return SR_FOUND;
} else {
- // go to the last part of the unsuccessful search
- text->setCursor(bv, prev_par, 0);
return SR_NOT_FOUND;
}
}