Jump to content
PeterPanettone

A simple Code Editor trick to quickly jump to predefined locations in a huge unit

Recommended Posts

OK, here is another simple trick I often use to quickly jump to specific locations in very large units (e.g., 20,000 lines, like in my upcoming "Advanced Windows Start Menu"):

We could use simple bookmarks for this purpose, but I often clear them all after finishing a specific short-term task. So we need something more persistent:*

 

*Prerequisites: CnWizards

 

1. Create these kinds of comments on the locations you want to jump to quickly:

 

implementation // toc_implementation
public // toc_public
// toc_PrivateVariables
private // toc_private
TForm1 = class(TForm) // toc_MainFormClass
// etc.

 

2. Then put all these TOC items at the very top of your huge unit:

 

{TOC:
toc_implementation
toc_public
toc_PrivateVariables
toc_private
toc_MainFormClass
}

 

3. Then, when you need to quickly jump to one of these locations in your huge unit:

 

- Press CTRL+Home to jump to the top of the unit
- Double-click one of the toc_ items to select it
- Press F3 to quickly jump to this location

 

This will save you a lot of search time!

 

Edited by PeterPanettone

Share this post


Link to post
9 hours ago, PeterPanettone said:

- Double-click one of the toc_ items to select it
- Press F3 to quickly jump to this location

Hm, interesting. I didn't know that F3 automatically searches the next occurrence of the selected text.

[testing it]

No, it doesn't, at least not in my Delphi 13 installation. I have to press Ctrl+F and enter first.

 

😕 ??

Share this post


Link to post
1 hour ago, dummzeuch said:

Hm, interesting. I didn't know that F3 automatically searches the next occurrence of the selected text.

[testing it]

No, it doesn't, at least not in my Delphi 13 installation. I have to press Ctrl+F and enter first.

 

😕 ??

It doesn't??

 

In my Delphi 12.2 and Delphi 13, it does!

This is very strange!

Share this post


Link to post

I've found it: F3 automatically searches the next occurrence of the selected text only if CnWizards is installed.

 

I've tested it by unloading CnWizards. When CnWizards is not loaded, then F3 on the selected text displays this message:

 

image.thumb.png.749ce23070a3b7d15c4107097f36b018.png

 

And then, when clicking the "Yes" button after having checked "Wrap around without asking", this message is displayed:

 

image.thumb.png.8fcf4049e95cc7bddc3781a2792d89f1.png

 

This could be a bug in the Delphi IDE that CnWizards resolves.

  • Like 1

Share this post


Link to post

MMX has a feature Find next/previous occurrence: Place the cursor somewhere into the specific identifier and press Shift+Alt+Right/Left.

 

You can combine this with the IDE Search Enhancement feature, which adds all identifiers of the current unit to the Ctrl+F search box.

  • Like 3

Share this post


Link to post

 

3 hours ago, Uwe Raabe said:

MMX has a feature Find next/previous occurrence:

So does GExperts, but the MMX one is nicer :).

Edited by pyscripter

Share this post


Link to post
On 9/18/2025 at 10:22 AM, Uwe Raabe said:

MMX has a feature Find next/previous occurrence: Place the cursor somewhere into the specific identifier and press Shift+Alt+Right/Left.

 

You can combine this with the IDE Search Enhancement feature, which adds all identifiers of the current unit to the Ctrl+F search box.

This is a very nice feature - thank you for that!

 

The list showing the references is semi-transparent, which hinders readability. Is it possible to switch the list transparency off?

Edited by PeterPanettone

Share this post


Link to post
1 hour ago, PeterPanettone said:

Is it possible to switch the list transparency off?

image.thumb.png.eec5b7d6c3d50e53becc123b72ce589d.pngimage.png.49286d14edff229609a863a2e9d2cc57.png

  • Like 1

Share this post


Link to post
9 minutes ago, Uwe Raabe said:

image.thumb.png.eec5b7d6c3d50e53becc123b72ce589d.pngimage.png.49286d14edff229609a863a2e9d2cc57.png

Thank you! However, when I set it to 255, I get this error message:

 

image.thumb.png.476a12e6e840246e08e439fe0a7917fe.png

So I have set it to 250, which gives me almost complete opacity.

Share this post


Link to post
10 minutes ago, PeterPanettone said:

However, when I set it to 255, I get this error message:

Works here without problems. The error shown is probably caused by something different.

 

If you can give steps to reproduce I will try to find the cause and fix it.

Share this post


Link to post
1 hour ago, Uwe Raabe said:

Works here without problems. The error shown is probably caused by something different.

 

If you can give steps to reproduce I will try to find the cause and fix it.

I've set it again to 255, and the error message didn't appear again.
I will re-examine MMX settings, as it seems that new features have been added since my previous version.
Thanks again for MMX! This is a great piece of software that adds features to the Delphi IDE that Embarcadero didn't have time to implement.

 

BTW, a new feature coming to my mind: Create a table that lists how many times and where (link) each method is used. This would also allow the user to find methods not used at all.

Edited by PeterPanettone

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×