Commit Graph

112 Commits

Author SHA1 Message Date
Allan Odgaard
2568503056 Fix executing bundle items via UI for non-main window
This affected executing bundle items via the Bundles menu (including the Select Bundle Item… dialog) in the text view used in the bundle editor.
2013-05-26 15:15:51 +08:00
Allan Odgaard
126ff16b58 Increase TextMate’s lifetime
We now warn 45 days after the compilation date and refuse to work 90 days after the compile date.
2013-05-17 16:18:22 +07:00
Allan Odgaard
ce4ae62547 Change ‘variables_for_path’ API
We now accept the a directory in addition to the path. If a directory is provided, the path is only used to filter variables rooted at the directory.
2013-05-12 11:09:18 +07:00
Allan Odgaard
8b3f05485d Change argument ordering for ‘scope_variables’
Generally we should always provide a base environment, since the scoped variables are format strings. The filtering scope selector is however optional, and we do not have one when executing commands outside an fi;e/editor context.
2013-05-12 11:09:17 +07:00
Allan Odgaard
02f688a525 Explicit variable setup for app controller commands 2013-05-12 11:09:17 +07:00
Allan Odgaard
f68a1cd280 Fix non-working link arrows in bundle item chooser
Since we released sender (via aliased pointer) before querying it, we would fail to obtain the item clicked.
2013-05-02 16:38:56 +07:00
Allan Odgaard
acaff3e352 Add expiration date to TextMate
The user will get daily reminders when the application is more than a month old, and it will stop working when it’s two months old.

Normally not a fan of expiring software but a significant amount of the requests sent to api.textmate.org (posting crash reports, updating bundles) are from versions more than a month old. Adding to that, the expiration date serves as a fallback for potentially broken software update checking.
2013-04-28 11:46:35 +07:00
Allan Odgaard
d45adf2fed Ask for confirmation to skip session restore
Sometimes shift is held down while TextMate is being launched for other reasons than to skip session restore, so to be safe, we are now asking the user to confirm their intent.
2013-04-10 10:13:01 +07:00
Allan Odgaard
bffa2eef10 Move bundle installing to BundlesManager 2013-03-26 16:00:53 +01:00
Allan Odgaard
099f7c60ea Improve bundles index code
By making it part of the BundlesManager singleton we can work with the event loop to coalesce reloads and delay saving the index.
2013-03-25 22:56:49 +01:00
Allan Odgaard
d1a6c854a1 Add API to control bundle auto-updating 2013-03-25 13:04:40 +01:00
Allan Odgaard
37590bd3fd Switch to new bundle loading code 2013-03-25 12:48:39 +01:00
Allan Odgaard
f7ad857385 Show current selection string in Go to Line dialog 2013-03-25 10:25:59 +01:00
Allan Odgaard
2c85ef9ac2 Move crash reporter info to utility.h 2013-03-20 11:30:40 +01:00
Allan Odgaard
74f22623e9 Don’t disable NSQuitAlwaysKeepsWindows
This was disabled in an attempt of avoiding the “do you want to open saved documents from last session?” which appear after a crash.

It doesn’t seem to have any effect though, so just noise in the code.
2013-03-19 15:51:08 +01:00
Allan Odgaard
769831f629 Use Objective-C literals 2013-03-19 15:49:18 +01:00
Allan Odgaard
3a75199e9d Use menu validation to update bundle menu item titles
This means we don’t need to know if there is a selection when creating the menu items and long-term it’ll be easier to introduce more complex updating, e.g. make the title a format string to allow referencing TM_DISPLAYNAME or disable the menu item if its requirements cannot be met.
2013-03-16 17:49:48 +01:00
Allan Odgaard
976dab5065 Only show bundle updates for this and last year
This makes the list appear noticeable faster. The dates are presently hardcoded to 2012 and 2013.
2013-03-16 17:49:48 +01:00
Allan Odgaard
38992fadef Simplify NSMenu subclass
Now that the bundle menu doesn’t register any key equivalents, there is no need to manually go through all but the bundle menu to avoid having the system trigger bundle menu items.
2013-03-14 10:14:46 +01:00
Allan Odgaard
db5df4a58c Update Find window API 2013-03-13 12:37:22 +01:00
Allan Odgaard
13edc6d131 Use O_CLOEXEC when opening files
This avoids leaking file descriptors into child processes, which would otherwise happen if another thread forks while the file descriptor is open.
2013-03-10 16:07:10 +01:00
Allan Odgaard
4a24d0ad58 Rework find dialog (part one)
This is work in progress but I don’t think any functionality is missing compared to previous commit, although some functionality might be less polished, e.g. the action buttons don’t properly enable/disable and the height of the results list gets lost when hiding it.

Some of the stuff that has changed / improved:

 * The find/replace text fields adjust their height to encompass the content (closes #94). Presently though the initial height of the ontrols is one line regardless of content (but they should adjust on first edit).
 * You can use Save All (⌥⌘S) to save affected files after Replace All (closes #558).
 * The key equivalents / actions available in the Find dialog is now easier to find via the action pop-up, which also has enables accessibility.
 * Using Next (⌘G) or Previous (⇧⌘G) with search results will move selection up/down.
 * Using Find All with ‘in’ set to ‘Selection’ will find and select all matches in the current document, which fixes #425, though it might be more desirable to show the results in the find dialog (like Find All does for a document or folder).
2013-03-07 10:50:19 +01:00
Allan Odgaard
6042bc86d6 Log current key event in diagnostic reports
When a C++ exception is thrown from code invoked via a menu item then the menu item dispatcher will catch the exception and abort, this means the report doesn’t show the actual exception or contain any of the involved code.

By logging the key event in the report we should be able to deduce what action was invoked.

Adding info to diagnostic reports “documentation” from http://mjtsai.com/blog/2013/02/27/application-specific-crash-report-information/
2013-03-01 16:41:01 +01:00
Allan Odgaard
a6e99c1853 Don’t call super in main menu key equivalent handler
It was calling super to keep our custom code to a minimum, but it turns out that the superclass will sometimes invoke bundle menu items even when items from the other menus are better candidates.

Partially reverts 4b0a9a08c7.
2013-02-23 11:24:56 +01:00
Allan Odgaard
cbb0a7864d Drop ‘ng’ namespace for scm 2013-02-21 17:39:55 +01:00
Allan Odgaard
63beedc6f4 Handle ⌥⌘⇠ / ⌥⌘⇢ in main menu subclass
This means they work (as alternatives for ⌘[ / ⌘]) in all windows with tabs.

We now also trigger menu-flashing for when pressing the keys.
2013-02-18 15:38:26 +01:00
Allan Odgaard
402e1f79b1 Use one bundle menu delegate for all menus
This avoids the problem of keeping the delegate retained while the menu is up (the menu item exists).
2013-02-12 20:11:50 +01:00
Allan Odgaard
0a0d9a3d9b Assign key equivalents to Go → Back/Forward
We use ⌘[ and ⌘] which is also used for Text → Shift Left/Right so we only set these keys for when the main text view is not active.

The main advantage is that you can now use these keys to move back and forth in history of HTML views (it also works in file browser, but due to a custom keyDown: overload, it also worked prior to this commit).
2013-02-11 21:58:29 +01:00
Allan Odgaard
e71fd192c5 Let SIGUSR1 relaunch TextMate
This is mainly to allow a way to test the relaunch code, as it is otherwise only used for s/w updating and installing plug-ins.
2013-02-11 14:21:22 +01:00
Allan Odgaard
ad03811df0 Ensure session restore when relaunching
The user can manually disable session restore, which is undesired when relaunching due to a software update or installing a plug-in, so we now override the user’s choice for the new instance launched.
2013-02-11 14:21:22 +01:00
Allan Odgaard
abf13e913a Show notification when posting crash reports (10.8)
This is both to remind the user that crash reports are automatically submitted and to make it easy for them to point us to a specific crash, as notification center will now work as a list of recent crashes; click on one of them to see the online version.
2013-02-08 11:20:36 +01:00
Allan Odgaard
b139ac5097 Change push_back → emplace_back (C++11)
This is mainly motivated by readability, so I only did a few select replacements.
2013-02-08 11:20:35 +01:00
Allan Odgaard
b6ba88cda5 Rework about window
We now perform the content hash (to see if release notes have changed) on a background thread.
2013-02-03 10:48:46 +01:00
Allan Odgaard
84587dccc9 mate: disable untitled document via user defaults
This is instead of setting an environment variable. Since there already is a user defaults setting for whether or not we want an untitled document created at startup, it seems nicer to have mate set that, instead of effectively introducing an alias for the setting.
2013-02-03 10:48:43 +01:00
Allan Odgaard
d5b3b07f32 Disable SCM status when app is inactive 2013-02-03 10:48:41 +01:00
Allan Odgaard
2bfe82fae4 Remove the AppStartup delegate
This temporary delegate was primarily used to ensure no message “slipped through” back when a license key was mandatory to run the alpha.
2013-02-03 10:48:40 +01:00
Allan Odgaard
32fcb52c68 Workaround for clang linker warning
Using instances with static storage in Objective-C files result in the following warning (starting with clang 425.0.24):

ld: warning: direct access in […] to global weak symbol […] means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
2013-02-02 08:52:12 +01:00
Allan Odgaard
45a126e5ff Improve page/tab support in about window
Selecting already selected page no longer reloads the HTML.

In addition to ⌘1-n for the n’th page, you can now also use ⌘{ and ⌘} to move between pages.
2013-02-02 08:50:35 +01:00
Allan Odgaard
6cbf3e5071 Use ns::create_event_string 2013-01-23 12:36:47 +01:00
Allan Odgaard
4b0a9a08c7 Change our main menu keyhandling ≠overload
We manually handle the Bundles menu (like before) and now use performActionForItemAtIndex: to make the menu flash (although presently only for the default items).

For the other menus we now call super and let that handle it. This means it might go into the Bundles menu, even though or menu delegate (for that menu) will say there are no key equivalents. This is only a problem for keys which do match items, but where all the items it matches are not supposed to fire.
2013-01-22 19:23:16 +01:00
Allan Odgaard
645f8d91e1 Let OS handle keys for Go to Tab submenu
My memory is a little vague here, but I believe the point of handling the menu keys was to workaround a bug in NSMenu.

The bug was that NSMenu would look at (the target of) cached menu items, probably for UI validation, so potentially sending methods to unretained objects, which could lead to a crash. Several workarounds were attempted (like clearing the target property after the menu had been displayed) but the only effective one was overloading key handling.

I’m quite sure though that this bug is no longer relevant.
2013-01-22 11:00:27 +01:00
Allan Odgaard
fae30ed6e8 Use wrapper for getpwuid() to avoid crash
Based on crash logs this problem still exists on 10.8.2 <rdar://10261043>.
2013-01-10 23:48:46 +01:00
Allan Odgaard
bccaee4be6 Simplify document open API
Removed the ability to specify wether documents should open in current window or a new window — all documents opened via this API will go through the same algorithm to find where the documents should end up (more choice is just adding confusion and complexity).
2013-01-10 06:46:44 +01:00
Allan Odgaard
d8cc115a5e Ensure we have a document in showWindow:
Also move (back) to using DocumentController instead of document::show().
2013-01-10 06:46:44 +01:00
Allan Odgaard
7b6515169f Remove unnecessary stuff
This includes the OakFilterWindow factory method as ‘new’ is just as good (now that ARC automatically autoreleases).
2013-01-10 06:46:44 +01:00
Allan Odgaard
211acb8a84 Use proper (specialized) type instead of ‘id’ 2013-01-10 06:46:43 +01:00
Allan Odgaard
531e8a44f1 Handle app termination in class method
It didn’t really make sense as an instance method since it iterate all instances, and we also want to execute code incase of no instances (save that fact as session data).
2013-01-10 06:46:43 +01:00
Allan Odgaard
a7a633f993 Remove procedural API for load/save of session
Since everything about session is now contained in the DocumentController class there is no need for invoking this from elsewhere and thus no need for the previous indirection.
2013-01-10 06:46:43 +01:00
Allan Odgaard
738456dbc7 Only let DocumentController schedule session saves 2013-01-10 06:40:03 +01:00
Allan Odgaard
8582b807a2 Improve support for percent escaped url parameters (txmt://)
Previously we would let NSURL parse the parameter and ask for the path component. This however does not support tilde as shorthand for the user’s home directory, and certainly not with TextMate 1.x’s questionable syntax (using ‘file://~/«file»’ instead of ‘file://localhost/~/«file»’ or possibly ‘file:///~/«file»’ although this one seems a little wrong).

As for percent escapes, the issue here is that if the URL parameter escapes slashes or colons, not decoding the URL parameter before creating an NSURL instance will fail (as the URL is malformed). If however we do decode percent escapes and the URL parameter contains spaces, then NSURL will also fail, as a URL with spaces is malformed.

So I ended up bypassing NSURL and check for a few variants of a ‘file://’ prefix (which is also what TextMate 1.x did).

This closes issue #602.
2013-01-09 00:28:17 +01:00