Commit Graph

272 Commits

Author SHA1 Message Date
Allan Odgaard
93e00f42b1 Fix potential missing last line in encoding view
This would happen if last line was not newline terminated.

The fix does not take into consideration that last line might contain non-ASCII, in which case it should be highlighted.
2013-11-03 20:37:48 +01:00
Allan Odgaard
c53b0cf42d Full paths on search clipboard are made relative to file chooser base 2013-11-03 20:37:34 +01:00
Allan Odgaard
323577a013 Use window positioning code from OakChooser 2013-10-27 20:04:48 +01:00
Allan Odgaard
3064fb82b4 Change text::range_t → ng::range_t 2013-10-20 19:10:02 +02:00
Allan Odgaard
0b0d0ef550 Disable wrapping for NSTextView
Unfortunately this doesn’t cause the container to get the proper width, but in most cases this is probably preferred over having the content wrap.
2013-10-19 21:41:03 +02:00
Allan Odgaard
2d1fbc1ff5 Add Go → Go to Tab → Last Tab (⌘0)
Closes #1150
2013-10-18 21:14:07 +02:00
Ryan Goulden
3548028a65 Always recommend plain text when opening files. 2013-10-10 02:39:44 -04:00
Allan Odgaard
0a47054e14 Fix potential exception in encoding selector sheet
Some valid UTF-8 byte sequences are not valid code points, so our “simple” validation is no guarantee that creating an NSString from the data will succeed.
2013-10-08 21:59:55 +02:00
Allan Odgaard
17a861fd37 Fix potential infinite loop in the encoding selector sheet 2013-10-08 21:59:55 +02:00
Allan Odgaard
5b27a39bb8 Fix compatibility with 10.7 2013-10-06 23:09:12 +02:00
Allan Odgaard
1baa953955 Set the encoding window controller as window delegate
No reason for this other than it seems right.
2013-10-06 23:09:11 +02:00
Allan Odgaard
72d6851eb0 Avoid leaking the encoding chooser sheet 2013-10-06 23:09:11 +02:00
Allan Odgaard
5f765ab061 Use encoding::classifier_t when opening files 2013-10-04 17:09:02 +02:00
Allan Odgaard
344fac505b Improve the “unknown encoding” sheet
A preview is now shown with the problematic lines highlighted.
2013-10-04 17:08:12 +02:00
Allan Odgaard
712a18cd50 Add IBAction to methods 2013-09-12 23:46:05 +02:00
Allan Odgaard
1ae67343f1 Add menu validation for close tabs related actions 2013-09-12 23:46:05 +02:00
Allan Odgaard
35ad8a1ed9 Add action method for closing tabs to the right 2013-09-12 23:46:05 +02:00
Allan Odgaard
aa08d67090 Let tab menu methods fallback on active tab
These normally require that the sender is an NSIndexSet or has one as its represented object, but with this commit, they will also be usable when there is no index set available, and will then simply use the active tab.
2013-09-12 23:46:05 +02:00
Allan Odgaard
e4a5db0f3b Only first call to window.close() would have an effect
This is a workaround for https://bugs.webkit.org/show_bug.cgi?id=121232
2013-09-12 23:46:04 +02:00
Allan Odgaard
8c7e68bf2f Ensure that at least 8 tabs stay open when auto-pruning 2013-09-12 23:46:03 +02:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
d58bb1fdde Avoid using NULL_STR with scope_t::push_scope 2013-09-03 12:10:18 +02:00
Allan Odgaard
32f4cedece Bring HTML output window to front on ⌃⌥⌘H when not already key
Previously it would hide if already visible regardless of being the key window or not.
2013-08-21 13:44:17 +02:00
Allan Odgaard
bffe0facff Change cancel button key equivalent: ⌘. → ⎋
The new key will still allow canceling the dialog using ⌘.
2013-08-18 17:29:29 +02:00
Allan Odgaard
a52165694c Move crash reporter info support to own framework
This is to avoid cyclic dependencies since it was previously in a somewhat high-level framework, so everything that framework depended on, could not augment crash reports.
2013-08-12 19:32:23 +02:00
Allan Odgaard
7fa1d96faa Fix crash when “close tabs” is sent to window with no tabs
It appears a window can hang around after its last tab has been closed. Such window receive notifications of items being deleted via the file browser, and will call the “close tabs” method in response to these, which does an out-of-range array access if no tabs exist.

The reason for why windows can hang around after last tab is closed has not yet been determined. It might be a retain cycle (bug) or a delayed release due to autorelease pools.

Fixes #1064
2013-08-10 11:41:40 +02:00
Allan Odgaard
5e5bbc468f Revert "The 10th tab now get ⌘0 as key equivalent"
This commit made the 11th tab get ⌘1 as key equivalent. Fixes #1078.

This reverts commit 5e6cfe8e1e.
2013-08-09 21:56:02 +02:00
Allan Odgaard
afcba9b1e8 Collect info related to a crash 2013-07-31 17:55:24 +02:00
Allan Odgaard
05efb628b4 Setup indent settings at a higher level
We now setup the indent settings when creating untitled documents where we know the folder, so that we can use potential settings scoped to that folder.

Since the document itself no longer sets this as part of regular buffer setup, we also set it when opening a document with a path, and when changing a document’s file type, although the latter is probably temporary.

Closes #305.
2013-07-29 15:50:31 +02:00
Allan Odgaard
6718a8a32c Use libdispatch for threaded write to pipe 2013-07-26 23:09:14 +02:00
Allan Odgaard
9db42905bf Also use Projects → Initial Location for ⌘T / ⇧⌘F
This settings is the fallback setting for when there is neither a file browser or project folder set for an untitled document.
2013-07-25 14:16:47 +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
ba85697ac4 Change “counterpart” to “related file”
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).
2013-07-21 13:25:27 +02:00
Allan Odgaard
34f13d5837 If no counterpart is found, create tab with custom path
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.
2013-07-11 13:44:48 +02:00
Allan Odgaard
698f08ab35 Allow customizing what is used for ‘Go to File Counterpart’ (⌥⌘↑)
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.
2013-07-11 00:23:25 +02:00
Allan Odgaard
ffae9da1d3 Only skip setting search folder for ⇧⌘F if already “owner”
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.
2013-06-21 11:49:16 +07:00
Allan Odgaard
b835952823 Don’t pre-select (find) “in selection” by default
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
2013-06-21 01:43:42 +07:00
Allan Odgaard
6c6aadc38b Make labels right-aligned by default 2013-06-17 12:36:27 +07:00
Allan Odgaard
d71f29074e Use symbolic name for REST API URL 2013-06-16 17:44:34 +07:00
Allan Odgaard
2af39bc935 Fix retain cycle
Fixes #1009.
2013-06-15 16:06:38 +07:00
Allan Odgaard
e80e9c5172 Remove private methods from header 2013-05-15 21:23:15 +07: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
e5cca3de18 Remove ‘document_settings’ API 2013-05-12 11:09:18 +07:00
Allan Odgaard
10e3536a80 Change method signature
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).
2013-05-12 11:09:17 +07:00
Allan Odgaard
d669c9733b Do not setup variables in document::run 2013-05-12 11:09:17 +07:00
Allan Odgaard
12491e22f8 Let OakTextView set TM_CURRENT_THEME_PATH
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.
2013-05-12 11:09:16 +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