From d55932fbb32757096eb02f2c042bdd084baafe49 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Mon, 10 Jun 2019 21:18:10 +0200 Subject: [PATCH] search & replace, find next, propose to restart from the doc beg/end if no match anymore --- src/u_search.pas | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/u_search.pas b/src/u_search.pas index 6cf5d35b..2e3982ff 100644 --- a/src/u_search.pas +++ b/src/u_search.pas @@ -507,6 +507,10 @@ begin end; procedure TSearchWidget.actFindNextExecute(sender: TObject); +const + r: array[boolean] of string = ('beginning', 'end'); +var + s: string; begin if fDoc.isNil then exit; @@ -533,7 +537,14 @@ begin fDoc.CaretX := fDoc.CaretX + 1; end; if fDoc.SearchReplace(fToFind, '', getOptions) = 0 then - dlgOkInfo('the expression cannot be found') + begin + s := format('the expression cannot be found, restart from the %s ?', [r[chkBack.Checked]]); + if dlgOkCancel(s) = mrOk then + begin + chkFromCur.Checked:=false; + actFindNextExecute(nil); + end; + end else begin fHasSearched := true;