Showing posts with label ide. Show all posts
Showing posts with label ide. Show all posts

Tuesday, December 2, 2025

Delphi Tip of the Day: Editor Font > Line Height

Delphi 13 Options: Editor > Display > Font > Line Height

I recently installed Delphi 13 on my new development machine. And ever since I watch Alister Christie's Code Font video, I've been hooked on using Consolas. I like how it distinguishes between zero and capital "O".

When I brought up the options to change the editor font to Consolas I noticed a new Line Height feature. I played around with some different line heights and for me personally, I settled on 1.2 which fits my eye nicely.

Line Height of 1.2 fits my eye nicely


I don't remember seeing Line Height in Delphi 11. And a quick confirmation of the Delphi 11 IDE options proves it's not there. I installed Delphi 12 but never really used it. I did a quick check and lo and behold the Line Height feature is available in Delphi 12. I must have missed it because I totally skipped using 12 all together.

I also decided to check out if there were any other fonts I might like. Here is the list of  alternatives to Consolas that ChatGPT gave me. I tried the ones that were available in Delphi and decided to stick with Consolas.

Font What makes it good
Fira Code A modern monospaced font with programming ligatures (so =>, !=, ->, etc. can render as single, clean glyphs). Improves readability of symbol-heavy code.
JetBrains Mono Designed specifically for developers: clean shapes, tall lowercase letters (makes code easier on the eyes), and good clarity even at smaller sizes.
Hack A clean, well spaced monospaced font — good if you like clear distinction between similar characters (0 vs O, l vs 1). Good for plain-text editing or coding without fuss.
Cascadia Code Created by Microsoft for terminals/editors. Has optional ligatures and good support for modern coding environments. Works nicely for both GUI IDEs and terminals.
Source Code Pro A straightforward, clean monospaced font with consistent spacing and good legibility — useful if you prefer simplicity over styling.
Iosevka A very flexible monospaced font (lots of glyph/width/variant options), popular among people who want tight control over how their code appears.
DejaVu Sans Mono A classic, reliable open-source monospace font with wide character coverage and solid legibility — good fallback or default choice on many platforms.


Here is Alister Christie's video on code fonts I watched many years ago. Wow, this video was released in 2013.



Enjoy!
Semper Fi
Gunny Mike
https://zilchworks.com



Saturday, November 29, 2025

How Ray Konopka Improved My Delphi Code Overnight

Every now and then, you get a piece of advice that stays with you. Not because it was dramatic or complicated, but because it quietly made everything better.

Two years ago, I sent a simple question to Ray Konopka — the Ray Konopka — about his coding style. I had noticed that his Delphi method declarations didn’t look like the IDE defaults. He added spaces inside parentheses and brackets, and his code just… breathed better. It had clarity.

I finally went back and reread that email thread, and I realized something.

The guidance Ray gave me that day permanently changed how I write Delphi code.

This blog post is long overdue.

How It Started

Here is the short version of what I asked Ray. I wanted to know why his method declarations looked like this:
procedure FormCreate( Sender: TObject );

Instead of the standard IDE formatting:

procedure FormCreate(Sender: TObject);

My question was simple:
Is there a setting that does this automatically? And why do you prefer this style?

Ray’s reply was thoughtful, detailed, and generous. And it opened my eyes to something subtle but powerful.

Why Ray Adds Spaces Inside Parentheses

Ray explained that adding a space after the opening parenthesis and before the closing parenthesis helps your eyes distinguish the method name from the parameter list. It creates a visual delimiter that makes code easier to scan.

He illustrated this beautifully by showing side-by-side method declarations from the TString class. With spacing added, the entire block becomes more readable and less cramped.

When you look at example after example, the difference becomes obvious — almost impossible to ignore.

Smart Tab: The Secret Weapon

The second thing Ray emphasized was the use of Smart Tab.

With Smart Tab enabled, wrapping long parameter lists becomes far easier and dramatically cleaner. Ray demonstrated it with a real method declaration on multiple lines, perfectly aligned with a single press of the Tab key.

After seeing that, I turned Smart Tab on — and I’ve never turned it off again.

Delphi 13 Options - Smart Tab

https://docwiki.embarcadero.com/RADStudio/Florence/e/index.php/Source_Options#Options_tab

The Three Rules That Changed My Coding Style

After just three days of practicing what Ray shared, I wrote him back with a summary of what made the biggest impact on my coding clarity. Here were the top three:

1. Smart Tab On

It makes aligning wrapped parameters effortless. This one toggle improves readability more than people realize.

2. Spaces after ( , [ and before ] , )

This small visual pause gives every method declaration and parameter list more clarity. It is now second nature for me.

3. Two blank lines between method implementations

This simple spacing rule makes code blocks easier to navigate, search through, and mentally organize. It is one of the fastest ways to reduce visual clutter.

These three rules alone made my Delphi source code noticeably cleaner.

Not fancy. Not complicated. Just better.


Ray’s Full Coding Style Guide

At the end of our email exchange, Ray did something incredibly generous. He made the full Raize Delphi Coding Style Guide available as a free PDF download.

If you want the complete reference, you can access it here:
https://raize.com/wp-content/uploads/RaizeDelphiCodingStyleGuide.pdf

This is required reading for any Delphi developer who cares about clean, consistent, readable code.

Two Years Later

I’ve been following Ray’s guidance ever since that email exchange. You’ve even seen it in the code I’ve generated or shared online — it became the standard I hold myself to.

What surprised me most is how such small adjustments created such a big improvement. Enough improvement that I felt compelled to finally write this post, two years delayed but not forgotten.

Ray — thank you for the clarity, the generosity, and the craftsmanship you bring to the Delphi community.


Enjoy!
Semper Fi
Gunny Mike
https://zilchworks.com

P.S.
Over the past two years, every time I asked ChatGPT to help me generate Delphi source code, I asked it to follow the Konopka Style Guide. It became my north star for clean, readable formatting — and even AI had to get on board.


Sunday, September 1, 2024

Delphi Tip of the Day: How to Keep Your Code Folded in Delphi 12

I like the "Code Folding" feature of  Delphi. However, I noticed that every time I reopened a project in Delphi 12 where I had previously folded the code, the code was no longer folded.

To keep your code folded in Delphi 12 you need to turn on the Save project desktop when closing option inside the IDE.

Tools > Options > IDE > Saving and Recovering

This option is unchecked in the default, out-of-the-box setup.


Delphi 12 also includes a new feature called Save editor state when closing a tab any time
https://docwiki.embarcadero.com/RADStudio/Athens/en/Saving_and_Recovering

Save editor state when closing a tab any time When selected, the current state for the views is saved before closing it. State info includes collapsed regions, cursor/caret position, and bookmarks.

This allows you to close and reopen a tab within the same editing session, and when the tab is reopened it will display exactly as it was when it was closed. This is similar to the Save project desktop when closing setting but functions all the time, not just when closing and reopening a whole project.

This option can only be enabled when Save project desktop when closing is checked.

Let me know in the comments what other out-of-the-box tweaks you like to make to a brand new Delphi install.

Enjoy!
Semper Fi,
Gunny Mike
https://zilchworks.com