30 Jul 2025

Compiling Textmate 2: Rendering Boogaloo




TextMate, fresh in 2025, on macOS Tahoe

TextMate has been a mainstay of my development tool belt for a while now, and it’s one of the last truly native macOS editors still around. But development stalled, and with no updates since 2021, I figured – “How hard could it be to compile it myself?”

The Case of the Missing Gutter

Last time, we arrived at this compiled product:

One glaring issue here was the gutter… or lack thereof. In the previous post in this series, I said:

… but notice how the gutter is completely missing? And how the file browser’s background isn’t quite right? I’m not sure what’s causing that, but I want to assume it’s some NSColor deprecation thing that’s causing it to behave this way. Although, it’s just a hunch, and I’m not sure what to think yet. Some… creative… debugging with Apple’s Quartz Debug tool and its “Flash screen updates” toggle tells me that whatever’s rendering the gutter, is, in fact, updating the right bits on screen at the right time – it’s just completely invisible for some reason.

Gutter aside, some more digging led me to line 72 in the FileBrowser framework:

Frameworks/FileBrowser/src/FileBrowserView.mm : 72

_outlineView.backgroundColor = NSColor.clearColor;

Changing clearColor to something like redColor showed up immediately, and using windowBackgroundColor fixed the issue. But I’m not sure if this is the fix – I figure that it was set to clearColor to let the window background show through, but for some reason the window itself is stuck in this gray color. Although, I could be completely wrong here and the issue could be something else entirely.

But why would changing the background colour fix the issue at all? And why were bits on screen being updated, even though the updates weren’t really visual?

Some more debugging later, where I changed the themes around, I realised that that the gutter’s divider was being rendered across the entire window, instead of within its own bounds. After changing that to redColor instead of having it pick it up from the theme, this bug was caught red handed. (pun intended)

A-ha, gotcha!

So, to clip this to bounds, it was quite simple: `

Frameworks/OakTextView/src/OakDocumentView.mm

    87: gutterDividerView = OakCreateVerticalLine(OakBackgroundFillViewStyleNone);

(+) 88: gutterDividerView.clipsToBounds = YES;

… and here’s the result:

And changing it back to pick up the theme’s settings, this issue is completely fixed:

This was solved in fed17e9 fixed gutter not showing up

Fixing the tabs

Look closely at the tabs in the last image – the text seems to be hugging the bottom of the tabs. This somehow wasn’t the case last time, so I assume this is because macOS Tahoe increases the height of NSTitlebarAccessoryView.

This was quite simple to fix, I just had to change the hard-coded constraints…

Frameworks/OakTabBarView/src/OakTabBarView.mm

[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[close]-(4)-|" 
options:0 metrics:nil views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[title]-(3)-|" 
options:0 metrics:nil views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[overflow]|" 
options:0 metrics:nil views:views]];

… to automatic ones:

Frameworks/OakTabBarView/src/OakTabBarView.mm


[self addConstraint:[NSLayoutConstraint constraintWithItem:self.closeButton
                                                 attribute:NSLayoutAttributeCenterY
                                                 relatedBy:NSLayoutRelationEqual
                                                    toItem:self
                                                 attribute:NSLayoutAttributeCenterY
                                                multiplier:1
                                                  constant:0]];

[self addConstraint:[NSLayoutConstraint constraintWithItem:self.textField
                                                 attribute:NSLayoutAttributeCenterY
                                                 relatedBy:NSLayoutRelationEqual
                                                    toItem:self
                                                 attribute:NSLayoutAttributeCenterY
                                                multiplier:1
                                                  constant:0]];

[self addConstraint:[NSLayoutConstraint constraintWithItem:self.overflowButton
                                                 attribute:NSLayoutAttributeCenterY
                                                 relatedBy:NSLayoutRelationEqual
                                                    toItem:self
                                                 attribute:NSLayoutAttributeCenterY
                                                multiplier:1
                                                  constant:0]];

Et voila, fixed.

This was solved in ba00428 fixed OakTabView constraints to visually center tab bar content on macOS Tahoe

What next then?

Honestly… no clue. There’s a few aesthetic changes I want to make in certain places, but that’s about it. TextMate is fully working and completely functional on macOS Tahoe, newly compiled.



···




Read more —

14 Jul 2025
Writing an Operating System from Scratch
Abstracting every single layer of computer software, from metal to user.

8 Jun 2025
RIP, Bill Atkinson


21 Apr 2025
Cataloging my books with ISBN barcodes and Google Books
Barcodes are a godsend.

< all blog