Commit Graph

240 Commits

Author SHA1 Message Date
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
Allan Odgaard
ea206ed269 Setup attr.os-version as part of document scopes
While not exactly a document scope, the advantage is that document scopes are always set, where project scopes are only setup for “projects”.
2013-04-01 13:22:41 +07:00
Allan Odgaard
ac23c9538e Bind to updated BundlesManager binding properties 2013-03-25 20:31:48 +01:00
Allan Odgaard
787ae1cba8 Only “force” selection search when document window is key
Since the find dialog itself will call orderFrontFindPanel: when selecting the first item in the “in” pop-up (this is required to have it show ⌘F as key equivalent) we need to avoid changing search scope to “selection” for this case.
2013-03-22 12:39:44 +01:00
Jacob Bandes-Storch
37e98655ec Implement filter through command
Closes #131
2013-03-21 22:12:08 +01:00
Allan Odgaard
d021d97b43 WIP: Filter through command 2013-03-21 14:39:48 +01:00
Allan Odgaard
d68e6a0499 Dragging last tab from window w/o file browser will close window
Closes #904.
2013-03-19 14:56:23 +01:00
Allan Odgaard
398e55cdbe Add helper functions to get OS version
We need this in a few places and while calling Gestalt() isn’t that much code, that function is deprecated in 10.8 and the alternative is a lot more code, so we don’t want to repeat that once we update the code.
2013-03-17 15:44:06 +01:00
Allan Odgaard
b0a0df831a Add ability to set project folder via file browser
For now it is done via a new menu item in the top folder pop-up. It might be useful to also show this menu item in the general action menu.
2013-03-16 17:49:49 +01:00
Allan Odgaard
b5eb83d383 Refactor code 2013-03-13 12:38:12 +01:00
Allan Odgaard
db5df4a58c Update Find window API 2013-03-13 12:37:22 +01:00
Allan Odgaard
cceff2cb99 Clear previous frame when switching side of file browser 2013-03-11 17:28:34 +01:00
Allan Odgaard
514f65bcb5 Improve window sizing when toggling file browser
The first time the browser is toggled, we’ll save the current frame so that we can restore it if the user toggles again (the calculated frame won’t match when window is moved or width is “truncated”).

Additionally when file browser is on the left side, we reframe the window so that the text view remains in the same place on the screen.

Closes #827.
2013-03-11 17:24:41 +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
ae15687db4 Move focus to document when closing split with focus
This applies to file browser and HTML output (when configured to be shown in the document window).

Closes #838.
2013-03-04 10:43:58 +01:00
Allan Odgaard
2c6504b82f Use symbolic constants for binding properties 2013-03-03 15:53:05 +01:00
Allan Odgaard
e8efb3638d Fix Go → Current Document with no project folder
We were creating an NSURL from the project folder which would throw an exception when the project folder was nil.
2013-03-01 22:03:58 +01:00
Allan Odgaard
5e6cfe8e1e The 10th tab now get ⌘0 as key equivalent 2013-02-27 21:05:09 +01:00
Allan Odgaard
c4323efbb7 Use path::is_child instead of custom code 2013-02-25 15:25:17 +01:00
Allan Odgaard
ca0c72e0c0 Fix potential retain loop via document SCM callback
If we closed a window with a document SCM callback for the current document, but that document was untitled (so it wouldn’t be cleared during shutdown), we would keep ‘self’ retained.
2013-02-22 17:59:42 +01:00
Allan Odgaard
e974f165a2 Add newFolder: forwarding to document controller 2013-02-21 22:08:52 +01:00