From ad0060454dc9a5fc1bf04d3de386cea6b88982cf Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Thu, 17 Dec 2009 07:53:20 +0000 Subject: [PATCH] Fix of bug ##6334 - now if you search for something not in the doc, it wraps around only once. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32558 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/lyxfind.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 8b2c934359..44d71490fb 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -934,7 +934,7 @@ int findForwardAdv(DocIterator & cur, MatchStringAdv const & match) { if (!cur) return 0; - int wrap_answer; + int wrap_answer = -1; do { while (cur && !match(cur, -1, false)) { if (cur.pit() < cur.lastpit()) @@ -947,12 +947,14 @@ int findForwardAdv(DocIterator & cur, MatchStringAdv const & match) if (match(cur)) return findAdvFinalize(cur, match); } + if (wrap_answer != -1) + break; wrap_answer = frontend::Alert::prompt( _("Wrap search?"), _("End of document reached while searching forward.\n" "\n" "Continue searching from beginning?"), - 0, 1, _("&Yes"), _("&No")); + 0, 1, _("&Yes"), _("&No")); cur.clear(); cur.push_back(CursorSlice(match.buf.inset())); } while (wrap_answer == 0);