diff --git a/cre.cpp b/cre.cpp index dbba4d75b..9dc3214d5 100644 --- a/cre.cpp +++ b/cre.cpp @@ -481,8 +481,9 @@ static int findText(lua_State *L) { int pos = ranges->get(0)->start.y; //doc->text_view->SetPos(pos); // commented out not to mask lua code which does the same CRLog::debug("# SetPos = %d", pos); + lua_pushinteger(L, ranges->length()); // results found lua_pushinteger(L, pos); - return 1; + return 2; } } return 0; diff --git a/crereader.lua b/crereader.lua index 1d8141755..e4d4d9878 100644 --- a/crereader.lua +++ b/crereader.lua @@ -611,16 +611,19 @@ function CREReader:searchHighLight(search) origin = 1 end - local pos = self.doc:findText( + local found, pos = self.doc:findText( search, origin, 0, -- reverse: boolean 1 -- caseInsensitive: boolean ) - if pos then + if found then self.pos = pos -- first metch position self:redrawCurrentPage() + showInfoMsgWithDelay( found.." hits '"..search.."' pos "..pos, 2000, 1) + else + showInfoMsgWithDelay( "'"..search.."' not found in document", 2000, 1) end self.last_search.search = search