An SE aid

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10337
Joined: Wed May 06, 2009 2:28 pm

An SE aid

Post by dunbarx » Tue Jul 23, 2024 4:58 pm

I thought I would share this. I have been using this gadget to help me navigate a long script in the SE. It hilites one or more groups of lines so I can easily scroll from one to the other, or find such a group at all.

By selecting one or more lines anywhere in the script, pressing F11 will change the backColor of those lines to yellow. You can do this to as many disparate groups of lines as you want. F12 clears the color of the entire script. If you paste anywhere in the handler, the new text inherits the backColor of the line into which you paste. If you delete lines anywhere, the script contracts, leaving the backColor intact.

In my setup a single very simple handler lives in a plug-in, available everywhere in LC. The attached stack has that handler resident.

The only thing I now wish for in the SE is the "Excel-like" folding of areas of the script, so that two (or more?) "panes" can be set up and vertically sized, allowing one to view and work in two (or more?) different sections of the SE at once. I have a large portrait monitor exclusively for LC scripts. I can see a lot of real estate at once, and being able to view any two (OK, last time, "or more?") sections of a script would be just lovely.

Craig

Edit: Made the stack a bit more instructive. The point is to use this for the SE in general.
SE Colorizer.livecode.zip
(5.11 KiB) Downloaded 176 times
Last edited by dunbarx on Wed Aug 07, 2024 3:42 pm, edited 6 times in total.

stam
Posts: 3089
Joined: Sun Jun 04, 2006 9:39 pm

Re: An SE aid

Post by stam » Tue Jul 23, 2024 9:31 pm

For my own purposes Bernd’s code folding solution is practically essential when working with long scripts because with one keystroke I can collapse all handlers and focus only those I care about at that point. And it can be set to group handlers and expand/collapse arbitrary code, I personally wouldn’t manually colourise code, but that’s just me. Maybe this works for others and whatever works is good ;)

Not sure how feasible it is, but what I would find useful is a VSCode feature: highlighting a word such as a handler or variable name highlights every instance of that same word in the script. In complex long scripts that can be a life saver (or at least a sanity saver!)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10337
Joined: Wed May 06, 2009 2:28 pm

Re: An SE aid

Post by dunbarx » Tue Jul 23, 2024 11:25 pm

Stam.
I would find useful is a VSCode feature: highlighting a word such as a handler or variable name highlights every instance of that same word in the script
Here, because I like you. :wink:

Craig
WordColorizer.livecode.zip
(1.38 KiB) Downloaded 219 times
Last edited by dunbarx on Wed Jul 24, 2024 3:44 pm, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10337
Joined: Wed May 06, 2009 2:28 pm

Re: An SE aid

Post by dunbarx » Tue Jul 23, 2024 11:29 pm

Stam.

I played with Bernd's lovely gadget. But I find myself navigating all the time from one portion of a long script to another, and find it very useful to know where the several pertinent sections of what I am working on are. I can jump from one to another; oftentimes there are a handful of them.

Anyway, the stack I sent you finds all the words in a field. You just have to modify it so it works with the fields in the SE, and that is a snap.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10337
Joined: Wed May 06, 2009 2:28 pm

Re: An SE aid

Post by dunbarx » Wed Jul 24, 2024 3:03 pm

Stam.

It is likely a good idea to change the line:

Code: Select all

find wordToFind in fld 1
to

Code: Select all

find whole wordToFind in fld 1
Craig

stam
Posts: 3089
Joined: Sun Jun 04, 2006 9:39 pm

Re: An SE aid

Post by stam » Wed Jul 24, 2024 3:16 pm

Thanks Craig will definitely have a look
(But currently on a Greek island ;))

Post Reply