Hi,

Mi wish was the second option.

I like the scite.MenuCommand, but I'm working with 1.71 :)
Well then I know of no way to invoke the command.


Hey, will scite.MenuCommand accept the constants as parameters?
No.

Take care,
-Mitchell;


[]'s
- Walter

On 2/2/07, mitchell <[EMAIL PROTECTED]> wrote:

Hi,

> Hi all. How I do a reverse find from the currente position using lua?
Are you using lua to find a search string? Or are you trying to get
SciTE to perform the backwards search via lua?

If the former:
Two ways I can think of.

-- 1, untested
local text = editor:textrange(0, editor.CurrentPos)
local last_pos
local s, e = string.find(text, search_string)
while s and e do
   last_pos = s
   s, e = string.find(text, search_string, s + 1)
end
-- last_pos contains the start position of the last occurance
-- of search_string

-- 2, untested
local pos = editor.CurrentPos
for i = pos, 0, -1 do
   local text = editor:textrange(i, pos)
   if string.find(text, '^'..search_string) then
     pos = i
     break
   end
end
-- pos contains the start position of the last occurance
-- of search_string

if the latter, why not just:

scite.MenuCommand(212) -- find previous

Take care,
-Mitchell;

>
> []'s
> - Walter
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Scite-interest mailing list
> [email protected]
> http://mailman.lyra.org/mailman/listinfo/scite-interest

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest



------------------------------------------------------------------------

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to