Skip to content

Rewrite SoftwareUpdate singleton#2

Closed
tectiv3 wants to merge 994 commits into
masterfrom
claude/sync-fork-upstream-q0LRr
Closed

Rewrite SoftwareUpdate singleton#2
tectiv3 wants to merge 994 commits into
masterfrom
claude/sync-fork-upstream-q0LRr

Conversation

@tectiv3
Copy link
Copy Markdown
Owner

@tectiv3 tectiv3 commented Mar 13, 2026

Changes:

  • Use NSURLSession and OakDownloadManager to download updates (instead of libcurl).
  • Use NSFileManager’s replaceItemAtURL:… to update the application bundle (instead of custom code).
  • Use NSTask to relaunch the application (instead of fork/exec).
  • Use the same window for the initial prompt, and for showing download progress.
  • Show estimated time remaining in download window (via NSProgress).
  • Allow retrying downloads on various forms of failures.
  • Don’t require xib file for download window.

Regressions:

  • We no longer support updating the application as root: I tried using an authorized NSFileManager instance, but it did not work for me, and the previous code we used for this was using legacy APIs.

sorbits added 30 commits May 24, 2020 17:27
Changes:

- Use NSURLSession and OakDownloadManager to download updates (instead of libcurl).
- Use NSFileManager’s replaceItemAtURL:… to update the application bundle (instead of custom code).
- Use NSTask to relaunch the application (instead of fork/exec).
- Use the same window for the initial prompt, and for showing download progress.
- Show estimated time remaining in download window (via NSProgress).
- Allow retrying downloads on various forms of failures.
- Don’t require xib file for download window.

Regressions:

- We no longer support updating the application as root: I tried using an authorized NSFileManager instance, but it did not work for me, and the previous code we used for this was using legacy APIs.
We only need this in one location, and it’s easy to handle at that call-site, rather than add complexity to something which is already a little opaque.
Also specify the object type (NSView*) for the arrays passed to OakSetupKeyViewLoop and OakAddAutoLayoutViewsToSuperview.
We either set it explicitly or rely on automatic key view loop calculations.

As for the latter: When auto-layout was initially introduced, the automatic key view loop calculation broke, as it used the view frames before layout. It should have been fixed several OS versions ago though, so we can use it again, as long as we are not working with view-based table views.
In this case, the function is a no-op.
For example when opening the window for the first time, the first responder will already have been setup when reaching the viewDidAppear method.
Also do not change first responder, as this belongs at a higher level, where we know which view would be a suitable first responder.
None of our preference panes have custom key view loops, therefore it is safe to call recalculateKeyViewLoop, if however we do introduce custom key view loops, we will need to update this code to account for that.
I think it will prevent multiple tests from being run in parallel, but when writing tests, we may produce a lot of output, that should not be buffered by ninja.

A future improvement could be to only use the console pool for the tests of the current target, but that will require two different rules to run tests.
The default for ragel is to generate compact and flexible code, not an issue for our current use case (parsing only comments and strings in ASCII property lists) but in the future we may need to tweak the output as ragel will be used for other things.
I occasionally see the Edit or Select button stretched, i.e. the status bar text field hugs its content fully, this is despite its hugging priority being set to low.

I did try to set it to NSLayoutPriorityDefaultLow-10 (assuming hugging priority of the buttons is NSLayoutPriorityDefaultLow), but I still saw the problem, so now we just allow space between the status bar and the buttons, rather than rely on the status bar to be stretched.
It appears that NSURL’s algorithm for “delete last path component” is to first append ‘../’ and then “normalize” the result, but the latter step can fail for some file URLs, for example with “file://localhost/path/to/https://macromates.com/” it will be stuck at the two slashes (continuing to append ‘../’).

Such malformed (file) URL can be created by running ‘mate https://macromates.com/’.
For example we may specify a transform for ‘.rl → .cc’ and another for ‘.mm.rl → .mm’. For a file named ‘fsm.mm.rl’ the build system would use the first rule seen, now it will always pick the latter, as it matches more of the suffix.
Previously all .rl files would be built as C++.
These tests are not exactly exhaustive and should probably be amended with more edge cases, especially now that the API has been simplified (so easier to add more tests).
This allows path to be either stored in a dictionary (as currently done) or be a getter method of a custom subclass.
sorbits and others added 28 commits May 17, 2021 21:19
Currently we assume all background and underline colors are for matched text, ideally we should check if the color match the non/emphasized color for background/underline.
Ideally the SCMManager should be moved out of the file browser framework, but I am not yet sure where the best place is.
This is the icon used for settings that are from key binding or property settings files.
While more code, it’s a step toward getting rid of the category extension method.
Specifically the folder pop-up menu and the zooming icon animation.

The former is so that we can ensure that the icon has a size of 16×16.
When the NSTextField is not editable then it will (by default) hug its content, which is undesired, since the potential views following the text field (tags and close button) should appear right-aligned.

In general though, we do not have controls after the text field when it is read-only, as it represents a missing file, so this is just for layout consistency.
We now log an error if we are unable to obtain the NSURLLocalizedNameKey property, but still cache the (fallback) name (so that we do not repeatedly try to obtain the missing property).
This is like ‘image’ but will dim the image when isModified returns YES.
Also remove icon from ‘target’ files, the previous name used for TextMate’s build configuration files.
We pass --minimum-deployment-target to ibtool so having the deployment target in the xib is redundant.

Furthermore, it appears that when building on macOS 11, a directory will be created for xib files when they:

1. Are a custom view (as opposed to a window)
2. Contains a deployment target
3. Contains a table view

Therefore, to successfully build on macOS 11 we cannot set deployment target for xib files meeting the above 3 criteria, which is easier when we only set the target in one place, instead of every single xib.

Thanks to Kevin Sjöberg for helping track this down.
See description of previous commit for more details.
User should set up FLAGS / LN_FLAGS in local.rave to point to where capnp is installed.
If user does not have dependencies in /usr/local then they must edit the file themselves.
This is for places where we normally want to show a (live) image representing a URL (and its modified/SCM status) via bindings, but occasionally, we want to show a static image.

For example the location shown in the file browser. This is normally a folder, but it could be “Computer”. Similar for folder search results when searching unsaved documents.
This makes binding menu items to a file reference image much simpler, as we do not have to bind to a property wrapper that resizes the image.

As a general rule, we always copy an image, before we change its size, so the image obtained from TMFileReference should always stay at its default size.
This is the last place using FileItem’s image property.
Comprehensive overview of TextMate architecture, build system,
code conventions, testing, and upstream comparison (992 commits behind).

https://claude.ai/code/session_011dCS6WrrLFadT1R7kAyPko
Comprehensive analysis of approaches for adding Language Server Protocol
support to TextMate, covering three implementation options (native C++,
Swift/ChimeHQ, Go proxy), existing community work, priority feature
mapping, and a phased rollout recommendation.

https://claude.ai/code/session_01CYQKwoSbws1DFg8mWQTFMf
@tectiv3 tectiv3 closed this Mar 13, 2026
@tectiv3 tectiv3 deleted the claude/sync-fork-upstream-q0LRr branch March 13, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants