Commit Graph

464 Commits

Author SHA1 Message Date
Allan Odgaard
386979ed2d Enable “backup on change” for documents
This was disabled (by accident) during the migration to OakDocument, although we would still backup document content when project properties were changed (like active tab or window size).

The reason we require DocumentController to explicitly enable backups is that we do not want backups for bundle editor and commit window, since these (currently) are unable to restore documents, and the former is never really closed, so the backups would live forever.
2016-08-29 21:24:34 +02:00
Allan Odgaard
ba8dfaf9fd Remove some unused document::run delegate methods 2016-08-28 13:32:49 +02:00
Allan Odgaard
c7d3aa3649 Move show_command_error to DocumentController 2016-08-28 13:32:49 +02:00
Allan Odgaard
e282dc2fd2 Remove commandRunner from HTMLOutputWindow and DocumentController 2016-08-28 13:32:49 +02:00
Allan Odgaard
0153e837a8 Remove document::run API 2016-08-28 13:32:49 +02:00
Allan Odgaard
f01bf97630 Add OakCommand responder methods to OakTextView and DocumentController 2016-08-28 13:32:48 +02:00
Allan Odgaard
d142f82f9f Check ‘isRunningCommand’ instead of ‘runner->running()’ 2016-08-28 13:32:48 +02:00
Allan Odgaard
bd61830833 Rework how we find suitable OakHTMLOutputView for command execution 2016-08-28 13:32:48 +02:00
Allan Odgaard
894b33d0bf Set frame autosave name of HTML output windows during creation 2016-08-28 13:32:48 +02:00
Allan Odgaard
c99e65b17c Let OakHTMLOutputView handle the “Stop Task?” warning sheet
This also allows for the sheet to automatically close, should the command exit before the user selects an action.
2016-08-28 13:32:47 +02:00
Allan Odgaard
4294889a79 Add comments about scope attributes 2016-08-28 09:13:41 +02:00
Allan Odgaard
0b15e58844 If duplicating the active tab’s document then we open the duplicate 2016-08-25 00:07:47 +02:00
Allan Odgaard
fbc7bab291 With multiple unsaved documents use Save All as button title 2016-08-22 16:14:36 +02:00
Allan Odgaard
3b3d86a320 Use WebView’s stopLoading instead of killing the running task
This is a more appropriate API to use for signalling that we wish to abort the running command.
2016-08-21 12:24:40 +02:00
Allan Odgaard
89c19eff61 Change ‘runningCommand’ getter to ‘isRunningCommand’ 2016-08-21 12:23:40 +02:00
Allan Odgaard
e457c8834f Only check network reachability when we know there are remote grammars
Previously we would check network reachability for all unknown file types, even if it lead to no grammar suggestion.
2016-08-21 12:09:32 +02:00
Ronald Wampler
860da518cb Add attr.project.swift scope
This scope can be used to support the Swift Package Manager tools (e.g., `swift build`).
2016-08-17 15:26:48 +02:00
Allan Odgaard
17a08d2c54 Do not call sync_open on a document which is loading
A document which is loading is likely showing a modal dialog (encoding view) and calling sync_open will run a local event loop which may then lock up the UI.
2016-08-17 15:23:05 +02:00
Allan Odgaard
7cff411632 fixup! Simplify code which inserts new documents into the tab bar
The simplified code did not remove duplicates from the documents to be inserted.
2016-08-10 11:31:11 +02:00
Allan Odgaard
19028bbd71 Using mate /path/to/folder would not use file type setting
This was only incase a new untitled document was created (rather than restore open files for the folder).
2016-08-07 20:43:11 +02:00
Allan Odgaard
076863e954 Add some extra checks to potentially avoid crashes 2016-08-05 23:19:18 +02:00
Allan Odgaard
26edab6a75 Running a command with output and no document would crash 2016-08-05 23:18:43 +02:00
Allan Odgaard
511e1d58a5 Remove old (crash reports) debug info 2016-07-16 13:14:43 +02:00
Allan Odgaard
c6bea5c3ff Update LINK dependencies in target files 2016-07-16 13:13:44 +02:00
Allan Odgaard
d9a9fd34bc Use OakDocumentEditor instead of ng::editor_for_document 2016-07-16 13:13:43 +02:00
Allan Odgaard
8cfd33481e Eliminate two document_t references 2016-07-16 13:13:43 +02:00
Allan Odgaard
1a7ef1af2b Improve termination UX with unsaved changes
Previously when multiple windows had unsaved changes we would use the frontmost window (with unsaved changes) for all the dialogs. Now we always bring to front the document for which we are presenting a sheet (like a save panel or encoding error).
2016-07-11 12:27:05 +02:00
Allan Odgaard
78c57eb213 Let showCloseWarningUIForDocuments: accept OakDocuments 2016-07-11 12:27:05 +02:00
Allan Odgaard
b6f111f0c9 Don’t cancel app termination when we need to show a save panel
Our previous save code was incompatible with the app termination event loop, so we had to abort app termination, but the updated code does not seem to have any issue.
2016-07-11 12:27:05 +02:00
Allan Odgaard
59f31a46a8 Remove old code used for saving documents 2016-07-11 12:27:05 +02:00
Allan Odgaard
b0ca4b1773 Use new save API in DocumentController 2016-07-11 12:27:04 +02:00
Allan Odgaard
84ecf729bd Use displayNameWithExtension: instead of DefaultSaveNameForDocument 2016-07-10 23:40:17 +02:00
Allan Odgaard
c12867182b Loading document can succeed, fail, or be cancelled by user 2016-07-10 23:40:16 +02:00
Allan Odgaard
73fba5b72b Remove unused import statement 2016-07-10 23:40:16 +02:00
Allan Odgaard
60180f77ec Let OakDocument post will/did save notification
With this change we only have OakTextView observe its current document.

This does mean that currently pre and post bundle actions are only executed for the selected document.
2016-07-10 11:29:41 +02:00
Allan Odgaard
9e06e35225 fixup! Use selected document’s path to find external scope attributes 2016-07-08 10:13:48 +02:00
Allan Odgaard
7619e6e9c2 Store document’s file type in session restore info 2016-07-07 12:19:45 +02:00
Allan Odgaard
1bab8548af Set project directory when restoring session
We would only set the “default” project directory and rely on the effective project directory being set when opening first document, however, for untitled documents we need the effective project directory to be setup prior to opening (to read the correct settings).
2016-07-07 12:19:45 +02:00
Allan Odgaard
9f1641911a Remove create_untitled_document_in_folder helper function 2016-07-07 12:19:45 +02:00
Allan Odgaard
2d50db451b Don’t update settings when creating untitled documents
This is now done (properly) when we open the document.
2016-07-07 12:19:45 +02:00
Allan Odgaard
5ef7bf1b9b Set document’s directory before opening it
This ensures we get proper folder specific settings for untitled documents that belong to a project.
2016-07-07 12:19:45 +02:00
Allan Odgaard
1aee165b4e Use document’s logical path for proxy icon etc. 2016-07-06 19:12:41 +02:00
Allan Odgaard
05fa669364 Be explicit about using selected document’s path for untitledSavePath
See rationale in commit d08250c428
2016-07-06 19:08:26 +02:00
Allan Odgaard
d08250c428 Use selected document’s path to find external scope attributes
We would previously use the documentPath property which does mirror the selected document’s path, but this will change to the logical path. Though for external scope attributes (such as which SCM or build system is used, only the real path makes sense).
2016-07-06 19:02:16 +02:00
Allan Odgaard
665ad94892 Document settings would not be read using document’s path
A document has both a virtual and an actual path. The virtual path is relevant e.g. when opening files via rmate, where we want to lookup file-type specific settings based on the remote path (filename) rather than the local temporary file. However, if there is no virtual path, we should fallback on the actual path, which broke when we made document_t a wrapper for OakDocument.

There is now a new logical_path getter which return the virtual path and fallback on the actual path.

Closes textmate/bugs#21
2016-07-06 16:46:07 +02:00
Allan Odgaard
3ef7c81470 Ensure a dropped tab is always moved
This is done by asking to both close and insert the tab, which works as a move regardless of the “re-order tabs” setting.
2016-07-04 23:10:37 +02:00
Allan Odgaard
3812acf2bc Support providing same document(s) as insert and close arguments
This is a way to move a document. Normally inserted documents already open will be moved, but only if the user hasn’t disabled tab re-ordering.
2016-07-04 23:01:54 +02:00
Allan Odgaard
d3f7193415 Don’t use NSControl’s controlSize property (backwards compatibility)
This property wasn’t available before 10.10.
2016-07-01 21:26:41 +02:00
Allan Odgaard
1bc09c2ee7 Don’t go through buffer_t to get document’s indent settings 2016-06-30 22:48:17 +02:00
Allan Odgaard
cba83cc413 Opening a file without a grammar can now suggest installing a bundle
This can be disabled using:

	defaults write com.macromates.TextMate.preview disableBundleSuggestions -bool YES

Though the user can also hold option and select “Never” for a suggestions to never see that again, and once the user has a custom binding for a document’s type, no suggestion will be shown.
2016-06-30 16:22:10 +02:00