Re: Re: find/search the opened buffer and show the result list in the output pane
Gavin Holt <[email protected]> Tue, 16 Jul 2024 09:27:04 -0700 (PDT)
| Newsgroups | gmane.editors.scite.general |
|---|---|
| Message-ID | <[email protected]> |
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
On Sunday 24 March 2024 at 03:28:17 UTC guitarbug wrote:
Thanks Neil for the reply.
PS, I found that the "Filter" in the search can meet the function I need.
--
珍爱生命,远离网络
On Sun, Mar 24, 2024 at 5:00 AM Neil Hodgson <[email protected]> wrote:
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.
https://www.scintilla.org/SciTELua.html
Neil
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/scite-interest/16f347c8-84ae-4576-962d-ca334b50dd6dn%40googlegroups.com
<https://groups.google.com/d/msgid/scite-interest/16f347c8-84ae-4576-962d-ca334b50dd6dn%40googlegroups.com?utm_medium=email&utm_source=footer>
.
--
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/scite-interest/2fbc5e55-e856-478b-8d4a-367bb358be27n%40googlegroups.com.