38 Commits

Author SHA1 Message Date
Allan Odgaard
36fedf5bee Change most buffer helper functions to accept buffer_api_t 2016-06-13 13:01:10 +02:00
Allan Odgaard
30be46a166 Support discontinuous selections in command input API 2015-03-08 14:21:59 +07:00
Allan Odgaard
91f138c1ae Do not show non-existing locations as having been searched 2014-08-18 18:12:21 +02:00
Allan Odgaard
6d1da8ce97 Use bundle item’s effective name in error and cancel sheets
For example the bundle item “Execute Line / Selection” will (without a selection) show as “Execute Line” in the menu, and now also if the command causes the error sheet to appear or the user press ⌃C / ⌘. to prematurely kill it.
2014-04-09 15:15:36 +07:00
Allan Odgaard
6cc0108961 Rename document_t:{open,save} → document_t:sync_{open,save}
This makes it easier to search for code that use these functions.
2014-04-07 17:28:41 +07:00
Allan Odgaard
575c31b66f Fix error message for command requirements with no variable 2014-04-05 14:13:39 +07:00
Allan Odgaard
2a36fed4d8 Handle output window re-use options for commands 2014-03-10 09:39:52 +07:00
Allan Odgaard
16c09c2a92 Update API to reflect that setting command runner can’t fail 2014-03-09 17:13:57 +07:00
Allan Odgaard
3064fb82b4 Change text::range_t → ng::range_t 2013-10-20 19:10:02 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
6718a8a32c Use libdispatch for threaded write to pipe 2013-07-26 23:09:14 +02: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
d669c9733b Do not setup variables in document::run 2013-05-12 11:09:17 +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
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
29aa65d5d9 Use blocks for document save callback 2013-04-25 15:33:32 +07:00
Allan Odgaard
6c48d1d9d7 Always set variable for commands with requirements
Previously we would only set the variable if the command couldn’t be found via PATH. By always setting the variable, we remove redundancy from commands, as they can now rely on the variable instead of needing fallback code (to load via PATH).

The downside is that there are cases where a command may wish to know if the user explicitly set the variable, for example the Run command for Python will ignore the script’s shebang if the user explicitly set TM_PYTHON. As this command doesn’t use the requirement system, it’s not an actual problem. Should it want to specify the requirement, it can do so by using a variable like TM_PYTHON_AUTO and then in the locations array, set TM_PYTHON, this would allow the command to test if TM_PYTHON is set and if not, still have ‘python’ available via the TM_PYTHON_AUTO variable — although, should python not be found, the error dialog will tell the user to set TM_PYTHON_AUTO.

Issue #767
2013-02-18 21:55:59 +01:00
Allan Odgaard
b1dc3fce66 Fix missing variables for windowless commands 2013-01-13 11:56:08 +01:00
Allan Odgaard
4b369e3bf1 Close HTML output view when using exit_discard
This was also done by TextMate 1.x.
2013-01-13 11:56:07 +01:00
Allan Odgaard
aa59684c7e Rework document controller
While I have tried to keep most of the functionality the same (to get functional changes spelled out in the commit history) there are some significant changes:

When you open a folder or document(s) a default project folder will be based on the path(s) opened. This means that as long as you always open the root of your project (via `mate`, `open -a TextMate`, dragging the folder to TextMate, using the favorites (⇧⌘O), open dialog, `txmt:` URL scheme, or what have you), your project no longer require a `.tm_properties` file setting `projectDirectory` for Find in Folder (⇧⌘T), Go to File (⌘T), and similar to work as desired. Additionally the default properties now set a window title that include the project folder’s name (and SCM branch when available), so most projects can now also drop setting `windowTitle`.

Furthermore the file browser (for when opening documents) will default to the project folder rather than the folder set in Preferences (the latter is still used if there is no document, e.g. after ⌘N or ⌃⌘N).

The default project folder, even for opening a single document, means that opening more documents from the same folder (via Finder or perhaps something that uses the same temp folder for the local versions (which `rmate` does)) means that the following documents will open as tabs in the already open window (containing the first one opened). I _think_ this takes care of the common request of having all documents opened appear in new tabs of the frontmost window.

For managing tabs the ‘Merge All Windows’ action now ignores minimized windows. This means that if you wish to only merge a few windows then you can minimize all but those you wish to merge and then perform the action.

This commit should also address issue #117 (closing window’s last document via the file browser closes the entire window). Canceling a file open also no longer causes the entire window to close, but there’s still some work to do in this department (actually backtracking to previous state, which could mean closing the window if the window was opened only to show this document).

Prior to this commit the tab bar would be automatically pruned when overflowing, this is no longer the case, though this functionality should return.
2013-01-09 02:43:41 +01:00
Allan Odgaard
80379dcc06 Use auto-synthesized properties 2013-01-03 01:16:54 +01:00
Allan Odgaard
b84992bdb3 ARC: Update DocumentWindow framework 2013-01-02 01:46:46 +01:00
Allan Odgaard
3d45b788f1 Update block-based NSAlert API 2013-01-02 01:46:46 +01:00
Allan Odgaard
1791a48571 Fix potential crash when using “Edit Command…” button
The block used the ‘uuid’ variable, this variable was however a (const) reference, so it wasn’t safe to use within the block.

While fixing the bug (by introducing a local non-reference variable for the bundle item) we have also changed the code slightly, so that “Edit Command…” only shows when a bundle item is found (this is mainly in preparation for running shell commands that doesn’t have a bundle item, e.g. from a future “Filter Through Command” dialog).
2012-12-24 01:23:33 +01:00
Allan Odgaard
06d4b51f44 Fix memory leak
This was introduced when we introduced block-based alert sheets for command errors.
2012-12-24 01:22:29 +01:00
Allan Odgaard
71ec3d4c82 Add block-based show alert API 2012-12-16 21:27:06 +01:00
Allan Odgaard
4d8f0422ec Provide “More Info…” for unsatisfied command requirements
See issue #622 for more details.
2012-12-16 00:01:13 +01:00
Allan Odgaard
397dc877af Use a block-based wrapper for NSAlert
This code isn’t ideal: We should make it a function instead of a class and the ‘info’ property should instead be done using a captured variable.
2012-12-16 00:01:13 +01:00
Allan Odgaard
cf62b6e92b Improve error text for missing shell commands 2012-09-27 17:52:41 +02:00
Allan Odgaard
848d197f7a Use DocumentController over document_t 2012-09-18 17:33:01 +02:00
Allan Odgaard
c26e5c2d36 Scope attributes are now given to editor_t
While presently it works the same, it allows us to provide better scope attributes e.g. for untitled documents (which lack SCM attributes).
2012-09-18 17:33:01 +02:00
Allan Odgaard
3d3e44e1a4 Add TM_CURRENT_THEME_PATH
There’s a few commands which want to read settings from the current theme. So far these have been reading the theme UUID from TextMate’s settings and scanned the disk to find the corresponding property list.

This is pretty bad because theme UUID can be set in different ways, themes can be in arbitrary bundles, and the property lists can be in delta format.

The latter is not solved, though we ensure the variable point to the base theme, incase a delta exist. TextMate could simply write a non-delta version of the theme to TMPDIR and let the variable point to that, so we’re not really limiting ourself by adding this variable.
2012-09-12 18:30:37 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00