Commit Graph

260 Commits

Author SHA1 Message Date
Allan Odgaard
5f765ab061 Use encoding::classifier_t when opening files 2013-10-04 17:09:02 +02:00
Allan Odgaard
344fac505b Improve the “unknown encoding” sheet
A preview is now shown with the problematic lines highlighted.
2013-10-04 17:08:12 +02:00
Allan Odgaard
712a18cd50 Add IBAction to methods 2013-09-12 23:46:05 +02:00
Allan Odgaard
1ae67343f1 Add menu validation for close tabs related actions 2013-09-12 23:46:05 +02:00
Allan Odgaard
35ad8a1ed9 Add action method for closing tabs to the right 2013-09-12 23:46:05 +02:00
Allan Odgaard
aa08d67090 Let tab menu methods fallback on active tab
These normally require that the sender is an NSIndexSet or has one as its represented object, but with this commit, they will also be usable when there is no index set available, and will then simply use the active tab.
2013-09-12 23:46:05 +02:00
Allan Odgaard
e4a5db0f3b Only first call to window.close() would have an effect
This is a workaround for https://bugs.webkit.org/show_bug.cgi?id=121232
2013-09-12 23:46:04 +02:00
Allan Odgaard
8c7e68bf2f Ensure that at least 8 tabs stay open when auto-pruning 2013-09-12 23:46:03 +02:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
d58bb1fdde Avoid using NULL_STR with scope_t::push_scope 2013-09-03 12:10:18 +02:00
Allan Odgaard
32f4cedece Bring HTML output window to front on ⌃⌥⌘H when not already key
Previously it would hide if already visible regardless of being the key window or not.
2013-08-21 13:44:17 +02:00
Allan Odgaard
bffe0facff Change cancel button key equivalent: ⌘. → ⎋
The new key will still allow canceling the dialog using ⌘.
2013-08-18 17:29:29 +02:00
Allan Odgaard
a52165694c Move crash reporter info support to own framework
This is to avoid cyclic dependencies since it was previously in a somewhat high-level framework, so everything that framework depended on, could not augment crash reports.
2013-08-12 19:32:23 +02:00
Allan Odgaard
7fa1d96faa Fix crash when “close tabs” is sent to window with no tabs
It appears a window can hang around after its last tab has been closed. Such window receive notifications of items being deleted via the file browser, and will call the “close tabs” method in response to these, which does an out-of-range array access if no tabs exist.

The reason for why windows can hang around after last tab is closed has not yet been determined. It might be a retain cycle (bug) or a delayed release due to autorelease pools.

Fixes #1064
2013-08-10 11:41:40 +02:00
Allan Odgaard
5e5bbc468f Revert "The 10th tab now get ⌘0 as key equivalent"
This commit made the 11th tab get ⌘1 as key equivalent. Fixes #1078.

This reverts commit 5e6cfe8e1e.
2013-08-09 21:56:02 +02:00
Allan Odgaard
afcba9b1e8 Collect info related to a crash 2013-07-31 17:55:24 +02:00
Allan Odgaard
05efb628b4 Setup indent settings at a higher level
We now setup the indent settings when creating untitled documents where we know the folder, so that we can use potential settings scoped to that folder.

Since the document itself no longer sets this as part of regular buffer setup, we also set it when opening a document with a path, and when changing a document’s file type, although the latter is probably temporary.

Closes #305.
2013-07-29 15:50:31 +02:00
Allan Odgaard
6718a8a32c Use libdispatch for threaded write to pipe 2013-07-26 23:09:14 +02:00
Allan Odgaard
9db42905bf Also use Projects → Initial Location for ⌘T / ⇧⌘F
This settings is the fallback setting for when there is neither a file browser or project folder set for an untitled document.
2013-07-25 14:16:47 +02:00
Allan Odgaard
2c307cabce Allow setting a tab as “sticky”
Presently this can only be done by right-clicking the tab and selecting the “Sticky” option — if a tab is sticky then it will not be closed when executing any of the batch close actions (Close All Tabs, Close Other Tabs, Close Tabs to the Right, and holding option down while opening a file via file browser or file chooser).

Closes #1038.
2013-07-21 13:25:28 +02:00
Allan Odgaard
ba85697ac4 Change “counterpart” to “related file”
This applies both to the action method and the settings key, the latter is now relatedFilePath to indicate that it’s a full absolute path (neither relative or a glob pattern).
2013-07-21 13:25:27 +02:00
Allan Odgaard
34f13d5837 If no counterpart is found, create tab with custom path
This way, if we specify that ‘*.go’ has a counterpart of ‘*_test.go’ but no test file exist (and no other files with same base name) then ⌥⌘↑ will create a new tab using the test file path as default save path.
2013-07-11 13:44:48 +02:00
Allan Odgaard
698f08ab35 Allow customizing what is used for ‘Go to File Counterpart’ (⌥⌘↑)
The user can now set ‘counterpart’ in .tm_properties to the absolute path of what should be used for ⌥⌘↑. If the file does not exist (on disk or as an open tab) then TextMate will fallback to searching the current folder for a file with same name.

To switch between go source and go test files one could add the following:

   [ *.go ]
   counterpart = "${TM_FILEPATH/(_test)?\.go$/${1:?:_test}.go/}"

Here the regular expression transformation will remove ‘_test’ from the file name if it exists, otherwise add it.

One could also do multiple settings like:

   [ *.go ]
   counterpart = "${TM_FILEPATH/(?=\.go$)/_test/}"

   [ *_test.go ]
   counterpart = "${TM_FILEPATH/_test(?=\.go$)//}"

Here ‘*.go’ files get the ‘_test’ added to their name, though files matched by the ‘*_test.go’ glob will instead have it removed.
2013-07-11 00:23:25 +02:00
Allan Odgaard
ffae9da1d3 Only skip setting search folder for ⇧⌘F if already “owner”
The user may use ⇧⌘F either to bring existing results to front, or to start a new folder search for a potential different project.

If the dialog is not visible, we always initialize it fully. If already visible, we previously would not setup search folder since the current search folder might have been manually set by the user, which we do not want to overwrite.
2013-06-21 11:49:16 +07:00
Allan Odgaard
b835952823 Don’t pre-select (find) “in selection” by default
Previously this would be selected if the user had a multi-line selection and was pressing ⌘F. The old behavior can be restored using:

    defaults write findInSelectionByDefault -bool YES
2013-06-21 01:43:42 +07:00
Allan Odgaard
6c6aadc38b Make labels right-aligned by default 2013-06-17 12:36:27 +07:00
Allan Odgaard
d71f29074e Use symbolic name for REST API URL 2013-06-16 17:44:34 +07:00
Allan Odgaard
2af39bc935 Fix retain cycle
Fixes #1009.
2013-06-15 16:06:38 +07:00
Allan Odgaard
e80e9c5172 Remove private methods from header 2013-05-15 21:23:15 +07:00
Allan Odgaard
91901bfdd3 Call bundleItemPreExec:… from command execution
This is instead of having a copy of the same code. Ideally command execution would be called after potential pre-exec stuff, but macro execution is presently handled by editor_t which doesn’t have access to the higher level stuff.
2013-05-12 11:09:18 +07:00
Allan Odgaard
e5cca3de18 Remove ‘document_settings’ API 2013-05-12 11:09:18 +07:00
Allan Odgaard
10e3536a80 Change method signature
We return a variables map instead of updating a map passed in by reference. The previous API was mainly done because we couldn’t previously return non-POD from Objective-C methods. Returning a map with variables makes the API more exact, e.g. how to handle existing entries is no longer an issue (that is, the caller will have to chose the appropriate duplicate strategy).
2013-05-12 11:09:17 +07:00
Allan Odgaard
d669c9733b Do not setup variables in document::run 2013-05-12 11:09:17 +07:00
Allan Odgaard
12491e22f8 Let OakTextView set TM_CURRENT_THEME_PATH
Previously we relied on the delegate to set this, but a text view may not have a delegate. One could however argue that this is a “global” setting so should be set even when there is no text view.
2013-05-12 11:09:16 +07:00
Allan Odgaard
f02a68893d Don’t pass base environment to bundle_variables 2013-05-12 11:09:16 +07:00
Allan Odgaard
a6cf964e9f Remove callback support from document::run 2013-05-12 11:09:16 +07:00
Allan Odgaard
ccf2414768 Add pwd argument to command runner
Previously this was only possible to change by setting PWD in the passed-in environment.
2013-05-12 11:09:15 +07:00
Allan Odgaard
b66e58c4f8 Disambiguate function name 2013-05-12 11:09:15 +07:00
Allan Odgaard
7f4649ba32 Factor out deprecated variable collecting 2013-05-12 11:09:15 +07:00
Allan Odgaard
88ae04572c Handle “did-save” bundle item callback in OakTextView
While it’s easier to execute bundle items from a text view, it doesn’t work when saving documents that are not in the current text view.

This is an intermediate refactoring step — handling should (likely) end up in the DocumentSaveHelper class, but we need to improve dealing with command execution first, and by having the callback piggyback on the normal performBundleItem: method, we (temporarily) limit the code which use the command execution API, making refactoring easier.
2013-05-09 15:16:33 +07:00
Allan Odgaard
0fd03842b7 Move bundle requirement checking to bundles framework
This also generalizes it to being applicable to all bundle items (not just commands).
2013-05-09 15:16:33 +07:00
Allan Odgaard
5fd188531a Change naming of functions for obtaining variables
These are now all prefixed with what they are obtaining variables for (scope, document, bundle, …) which makes it easier to analyze/refactor the code.

Also change document_t’s settings function to document_settings.
2013-05-09 15:16:32 +07:00
Allan Odgaard
bcc3e4c1fb Fix refresh/undo for commands causing document saving
Since saving is asynchronous the scoped refresh/undo helper would do “cleanup” before the command ran and potentially made document changes.

Commands executed at a lower level (i.e. by editor_t via macros) presently still has this issue. This should be fixed when macros are refactored (this isn’t the only issue related to macros).

Closes #450.
2013-04-25 16:38:33 +07:00
Allan Odgaard
29aa65d5d9 Use blocks for document save callback 2013-04-25 15:33:32 +07:00
Allan Odgaard
9083ca8206 Close bundle install sheet on error
Previously incase of error the sheet would keep showing effectively locking up the document window.

This is related to issue #85 although the reason why installing bundles fails for some users is still unanswered.
2013-04-23 18:57:25 +07:00
Allan Odgaard
cdb75619ca Add completion callback to installBundle: 2013-04-23 18:52:08 +07:00
Dirk Geurs
a2128f11cd Setup document scope attr.project.lein for Leiningen projects
Leiningen is a build automation and dependency management tool mainly used for Clojure projects.

https://github.com/technomancy/leiningen
2013-04-03 23:07:30 +07:00
Allan Odgaard
0bf02dbeff Move divider line functions to OakUIConstructionFunctions.h 2013-04-02 04:11:32 +07:00
Allan Odgaard
9b94a279ac Setup document scopes for initial untitled document 2013-04-01 13:22:41 +07:00