find/search the opened buffer and show the result list in the output pane

47 views
Skip to first unread message

guit...@gmail.com

unread,
Mar 23, 2024, 1:31:31 AMMar 23
to scite-interest
Hi there,
I have a un-saved buffer opened, and I want to find/search something in this buffer and show the result list in the output pane, just like command "Find in files...", would you help on this? thank you.

guit...@gmail.com

unread,
Mar 23, 2024, 8:10:08 AMMar 23
to scite-interest
I 'm using SciTE Windows Executables V5.4.3

Neil Hodgson

unread,
Mar 23, 2024, 5:00:10 PMMar 23
to scite-interest

I have a un-saved buffer opened, and I want to find/search something in this buffer and show the result list in the output pane, just like command "Find in files...",

Quickest and easiest to save the buffer as a file and then Find in Files.

You could also implement a command in the Lua scripting language.

Neil

guitarbug

unread,
Mar 23, 2024, 11:28:17 PMMar 23
to scite-i...@googlegroups.com
Thanks Neil for the reply.
PS, I found that the "Filter" in the search can meet the function I need.
--
珍爱生命,远离网络


--
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scite-interes...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scite-interest/16f347c8-84ae-4576-962d-ca334b50dd6dn%40googlegroups.com.

Gavin Holt

unread,
Jul 16, 2024, 12:27:05 PM (11 days ago) Jul 16
to scite-interest
Hi,

This has been done before, I modified it to use the output window  - it seems to work with unsaved files :

function mark_all()              -- Mark and list occurrences
    -- Modified from http://lua-users.org/wiki/SciteMarkWord
    -- Fail if no selected text
    if editor.SelectionStart == editor.SelectionEnd then
        return
    end

    -- Use the current selection
    local txt = editor:GetSelText()

    -- Select the indicator properties
    local indic = scite.SetIndicator("word")

    -- Clear previous marks of this type - disable if you want to add marks together
    scite.SendEditor(SCI_INDICATORCLEARRANGE, 0, editor.Length)

    -- Setup the search parameters
    local flags = 0 --SCFIND_WHOLEWORD
   
    -- Perform an initial search
    local s,e = editor:findtext(txt,flags,0)
   
    -- Loop through the file
    while s do
        scite.SendEditor(SCI_INDICATORFILLRANGE, s, e - s)
        trace(props.FileNameExt .. ":" .. (editor:LineFromPosition(s)+1) .. ":" .. editor:GetLine(editor:LineFromPosition(s)))
        s,e = editor:findtext(txt,flags,e+1)
    end
end

Kind Regards 

Gavin Holt

Reply all
Reply to author
Forward
0 new messages