Commit Graph

35 Commits

Author SHA1 Message Date
Allan Odgaard
ba2130f0c8 Don’t change signal mask in library code
This belongs in main(), where it is already being set.

It might however be necessary to set it when running tests, although none of the tests seems to fail w/o this.
2013-03-21 14:39:35 +01:00
Allan Odgaard
13edc6d131 Use O_CLOEXEC when opening files
This avoids leaking file descriptors into child processes, which would otherwise happen if another thread forks while the file descriptor is open.
2013-03-10 16:07:10 +01:00
Allan Odgaard
c26a61a749 Remove “grammar changed” callback
This would cause a crash if grammar changed on disk for a document which was closed but not disposed.
2013-02-18 15:38:26 +01:00
Allan Odgaard
f980573d8b Ensure document is open during save
Saving is done asynchronously so the document might be closed while being saved. This in itself is not an issue, but the “post save” function will assume it has an open document for “marking as pristine” and executing potential “document did-save” callbacks on.
2013-02-11 14:21:20 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
540bf5daf1 Remove SCM variables from document_t 2013-02-02 11:14:35 +01:00
Allan Odgaard
57f4589dbb Broadcast “is on disk” after first save 2013-02-02 10:32:53 +01:00
Allan Odgaard
61b01c89f8 Use scm variables API 2013-01-20 12:49:33 +01:00
Allan Odgaard
e6a4254e61 Allow excluding untitled documents from document::scanner_t
The problem with this feature is that it includes all untitled documents including e.g. the current bundle item being edited. For things like ⌘T we only want to show untitled documents from the current window.
2013-01-18 05:46:27 +01:00
Allan Odgaard
8611aa3f11 Introduce document_t::detach_backup
This will reset the document’s backup path but not delete the backup on disk (which can be found via the document’s identifier).

This is useful if we wish to dispose the document but reconstruct it later (e.g. during application termination).
2013-01-16 04:42:51 +01:00
Allan Odgaard
a9745164c7 Exclude backups from document::find by default 2013-01-12 13:09:16 +01:00
Allan Odgaard
bccaee4be6 Simplify document open API
Removed the ability to specify wether documents should open in current window or a new window — all documents opened via this API will go through the same algorithm to find where the documents should end up (more choice is just adding confusion and complexity).
2013-01-10 06:46:44 +01:00
Allan Odgaard
759b7d1ae5 Introduce ui_proxy_t::show_browser 2013-01-10 06:46:44 +01:00
Allan Odgaard
a7a633f993 Remove procedural API for load/save of session
Since everything about session is now contained in the DocumentController class there is no need for invoking this from elsewhere and thus no need for the previous indirection.
2013-01-10 06:46:43 +01:00
Allan Odgaard
821be6acad Custom named documents don’t occupy an untitled counter
Previously if the custom name was set before the display name was requested, it would not allocate an untitled counter, but if set later, it would (effectively) not release the counter already allocated.
2013-01-08 22:48:08 +01:00
Allan Odgaard
1a3c9d5db9 Add missing const qualifier 2013-01-08 22:48:07 +01:00
Allan Odgaard
a0c4af64bd Remove trailing whitespace
Only removed from non-empty lines.
2012-09-25 14:16:50 +02:00
Allan Odgaard
48616a7ea1 Make document_t::scope private
Ideally should be removed entirely but as document presently does load/save where we need scopes (for import/export commands), we need it internally.
2012-09-18 19:38:01 +02:00
Allan Odgaard
8964971e98 Remove document_t::path_attributes 2012-09-18 19:38:01 +02:00
Allan Odgaard
45763d4afc Don’t require file to get SCM info
We didn’t actually use the file itself, only its parent directory, and there are several places we want SCM info for an untitled file’s project directory, so removing the need for a file simplifies things.
2012-09-18 17:33:02 +02:00
Allan Odgaard
4fc00f55e7 Update file scanner API to use glob_list_t 2012-09-12 18:30:36 +02:00
Allan Odgaard
b2fa6ff377 Remove UUID from settings API
Don’t recall what the intent was with this.
2012-09-11 00:05:05 +02:00
Allan Odgaard
2333b23fe7 When file is renamed, check if a new file takes its place
Xcode does some weird stuff while saving, it renames the existing file (twice), having it end up in some staging area with a UUID as filename, and then disappear.

Previously TextMate would track these renames, now it waits up to one second for a new file to appear using the old file’s path.
2012-09-10 23:17:32 +02:00
Allan Odgaard
77360e4a6b Proper undo management for external changes
This fixes issue #50.
2012-09-10 22:47:58 +02:00
Allan Odgaard
45b00164c4 Move document::is_binary to where it is used 2012-09-10 14:24:04 +02:00
Allan Odgaard
a3cedb5c58 Use std::function as callback type for setup_timer
There is a minor functional change in that the custom callback type uses event loop signaling that makes it safe to trigger the callback from a thread. This should however not be necessary for timers (which are all setup on the main thread).
2012-09-09 16:22:19 +02:00
Adam Strzelecki
c658687d08 New TM_SCM_NAME variable
This can be used together with `TM_SCM_BRANCH` to customize `windowTitle`.
2012-08-28 22:36:02 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
c7678e9f67 If file is not on disk, use tmProperties for encoding
This happens e.g. if we do ‘ls|mate’ — here we do have content which got a charset and newline mode assigned during “load”, but from the user’s POV he is saving a new file (if he saves the buffer) so should get his configured encoding.
2012-08-26 17:33:26 +02:00
Allan Odgaard
6f45ee4a9c Use encoding::type for open related API 2012-08-26 17:06:38 +02:00
Allan Odgaard
d1de4a8854 Use encoding::type for save related API
There is also a new document_t::encoding_for_save_as_path which returns the encoding that would be used for the document, if saved at the given path. If the document was loaded from disk, it will return the encoding used during load, otherwise it will check tmProperties for which encoding should be used for the path provided. Save dialog for untitled documents will be pre-populated with the result of the above function.
2012-08-26 16:13:20 +02:00
Allan Odgaard
f5c7301ba7 Use O_CLOEXEC when possible
This avoids having to do a fcntl(fd, F_SETFD, FD_CLOEXEC) to set the “close on exec” flag.
2012-08-24 16:52:42 +02:00
Allan Odgaard
3c79f275f1 Use constants for settings keys 2012-08-23 17:15:12 +02:00
Allan Odgaard
566d9b27dc Expose encoding variables for document_t 2012-08-21 23:45:45 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00