Closing Find/Replace Strips from Lua

108 views
Skip to first unread message

Gavin Holt

unread,
Aug 16, 2020, 7:08:25 PM8/16/20
to scite-interest
Hi,

Q1. Can I use Lua to close a built in strip (Find,Replace)?

I am using multiple user strips and can make each function close other user strips before opening new user strips or opening built in strips. However, I can't find how to close built in strips from Lua. Is this possible as I don't like having more then one strip open.

Kind Regards Gavin Holt

Neil Hodgson

unread,
Aug 21, 2020, 8:02:41 PM8/21/20
to scite-interest
Gavin Holt:

> Q1. Can I use Lua to close a built in strip (Find,Replace)?

You can call scite.MenuCommand(IDM_FIND) to toggle the find strip visibility but I don’t know of a technique to discover whether it is currently visible.

Neil

holt...@gmail.com

unread,
Aug 22, 2020, 4:27:55 PM8/22/20
to scite-interest

Many thanks I will set a flag on opening in built strips.

G

holt...@gmail.com

unread,
Aug 24, 2020, 8:16:59 PM8/24/20
to scite-interest
Hi,

I have taken your advice to "try and manage with the basic functionality included in the distribution" for customising SciTE. The Lua interface is very powerful and the new "quiet" os.execute is very welcome. Using the OnKey() event I can make my own keyboard shortcuts - overwriting the defaults if required.

However, I can't modify the outcome of commands issued by menu selection. In the context of this thread I can't keep track of which built in strip is open - if the strip is opened with a menu command. (I can intercept calls using keyboard shortcuts and set a props flag naming the active strip). 

I think Steve's C++ OnCommand() event handler[1] would solve this problem, would work across all platforms and would be a welcome addition to SciTE, unfortunately I don't have the skills to extract and translate this into a patch for SciTE.

[1] https://bitbucket.org/scite-ru/scite-ru.bitbucket.org/src/master/lualib/gui/gui_ext.cpp:1452



Food for thought.

Kind Regards Gavin Holt

Neil Hodgson

unread,
Aug 24, 2020, 8:52:58 PM8/24/20
to scite-i...@googlegroups.com
Gavin Holt:

> I think Steve's C++ OnCommand() event handler[1] would solve this problem, would work across all platforms and would be a welcome addition to SciTE, unfortunately I don't have the skills to extract and translate this into a patch for SciTE.

Reflecting commands into Lua is messy as they aren’t only from menu items but also other controls like the edit controls inside the find strip so OnCommand may occur unexpectedly. Or, if implemented only for menu commands, not occur in all desired circumstance. It is likely there will be confusion over its behaviour and users may have to examine the implementation. There will be differences between platforms.

If someone wants to add OnCommand then that would be OK.

Neil

holt...@gmail.com

unread,
Sep 24, 2020, 11:29:34 AM9/24/20
to scite-interest
Hi,

I am still struggling to find a solution to my problem.

I want to ensure that every time I call a strip with a hotkey it becomes the only strip visible i.e. the insertion point is in a consistent place).
This is a problem when using the built in strips.

Trial 1: Keep a properties flag every time I open a strip and use the toggle function to close it each time I call another strip.
Fails: I cannot intercept the ESC key from the built in strips to clear the flag if the strip is manually closed.

Trial 2: Write my own find/replace "user" strips and have full control of the opening and closing.
Fails: I can no longer use scite.MenuCommand(IDM_FINDNEXT) and scite.MenuCommand(IDM_FINDNPREV) because editor:find() uses a different store for "last search". I tried storing to props["find.what"] but scite.MenuCommand(IDM_FINDNEXT) does not seem to be reading this.

I understand this is a "corner case" of my own making, but would welcome any help.

Kind Regards Gavin Holt

Neil Hodgson

unread,
Sep 24, 2020, 6:31:18 PM9/24/20
to scite-i...@googlegroups.com
Gavin:

> I want to ensure that every time I call a strip with a hotkey it becomes the only strip visible i.e. the insertion point is in a consistent place).

If you mostly care about your own strips then you can remove the built-in find and replace strips with
find.use.strip=0
replace.use.strip=0

> scite.MenuCommand(IDM_FINDNPREV) because editor:find() uses a different store for "last search". I tried storing to props["find.what"] but scite.MenuCommand(IDM_FINDNEXT) does not seem to be reading this.

find.what is pushed out from the strips for use by "Find in Files”. It is never read by find or replace code.

Neil

holt...@gmail.com

unread,
Oct 1, 2020, 4:35:47 AM10/1/20
to scite-interest
Hi

Thank you for the clarifications.

It was the usability of your built in strips which convinced me to use the strip mechanism - I would not want to stop using them.

I am especially impressed with the incremental highlighting of regular expression matches - live as I type!

Once again thanks for SciTE I continue to enjoy using, exploring and learning.

Kind Regards Gavin Holt
Reply all
Reply to author
Forward
0 new messages