Commit Graph

54 Commits

Author SHA1 Message Date
Allan Odgaard
491fc8a3e3 Add missing semi-colons after assertion 2013-07-21 13:25:28 +02:00
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
1b61c9c688 Fix “unused variable” compiler warning 2013-07-21 13:25:27 +02:00
Allan Odgaard
d22f7163c5 Ensure tab size read from .tm_properties is larger than zero
Closes #1028.
2013-06-21 01:43:42 +07:00
Allan Odgaard
6ee93431bc Avoid passing -1 (as fd) to kevent() and close()
Observing paths will normally fail when opening files that only privileged users can read.
2013-06-15 16:05:48 +07:00
Allan Odgaard
e0523bb926 Improve encapsulation 2013-05-16 21:36:49 +07:00
Allan Odgaard
b6fce5fe30 Check if command result is valid UTF-8
This was previously implicit by using oak::command_t
2013-05-16 21:36:43 +07:00
Allan Odgaard
7dbb02652f Use io::spawn instead of oak::command_t for /usr/bin/diff3 2013-05-16 21:29:35 +07:00
Allan Odgaard
a366a5f9fe Move grammar changed callback from document → buffer 2013-05-15 15:45:36 +07:00
Allan Odgaard
58dc0b0491 Remove path::walker_t
The intent of this class was to allow ad-hoc recursive/lazy walking of a directory structure and having links only visited once.

It was however only used once, and for that task, path::entries() is sufficient.
2013-05-15 15:45:36 +07:00
Allan Odgaard
6e4926177e Provide symmetric content/set_content for document_t 2013-05-15 15:45:36 +07:00
Allan Odgaard
f5c63828ee Remove path attributes from document_t 2013-05-12 23:04:57 +07:00
Allan Odgaard
e5cca3de18 Remove ‘document_settings’ API 2013-05-12 11:09:18 +07:00
Allan Odgaard
4a32881c11 Remove legacy variable functions 2013-05-12 11:09:17 +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
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
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
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