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.
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).
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.
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.
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.
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
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.