4348 Commits

Author SHA1 Message Date
Allan Odgaard
9e2156dda1 Resize Terminal preferences pane
It now matches the width of the other preference panes, so the preferences window will only change height when changing preferences panes (unless the user has manually resized any of the resizable preference panes).
2020-04-19 16:31:03 +07:00
Allan Odgaard
fc0d4e32b4 Save xib with Xcode 11.4.1 (11E503a) 2020-04-19 16:31:03 +07:00
Allan Odgaard
a7ca1f0fb3 Remove support for redirecting stderr to a file 2020-04-19 14:32:30 +07:00
Allan Odgaard
355725cf36 Create Variables preference pane with code 2020-04-19 14:32:30 +07:00
Allan Odgaard
666ac73864 Update default size of bundles preferences pane to match projects
The goal is to have the window resize as little as possible when switching to another preference pane, therefore we aim for at least making the width the same for all panes.
2020-04-19 14:32:30 +07:00
Allan Odgaard
9e7d727792 Create Software Update preference pane with code (using NSGridView) 2020-04-19 14:32:30 +07:00
Allan Odgaard
b938dce914 Create Projects preference pane with code (using NSGridView) 2020-04-19 14:32:30 +07:00
Allan Odgaard
bdedf08bd7 Create Files preference pane with code (using NSGridView) 2020-04-19 14:32:30 +07:00
Allan Odgaard
5aef1c5c8a Add helper function to configure NSGridView for our preference panes 2020-04-19 14:32:30 +07:00
Allan Odgaard
c8faa0fa91 Don’t opt-in to making the preferences window restorable 2020-04-19 14:32:30 +07:00
Allan Odgaard
40379d8ab1 Remove (unused) general preferences pane
This was just a placeholder/template.
2020-04-19 14:32:30 +07:00
Allan Odgaard
4e0cb76985 fixup! Convert to reference URL for file browser’s “Select Current Document” 2020-04-18 15:22:13 +07:00
Allan Odgaard
23d2de534b Use NSStackView to manage OakScopeBarViewController’s buttons 2020-04-17 19:19:53 +07:00
Allan Odgaard
ca8075b5c4 Update Bundles preferences pane to use OakScopeBarViewController
The MGScopeBar class uses deprecated API, doesn’t support dark mode, and doesn’t seem to be maintained, therefore it’s better to switch to OakScopeBarViewController, although it doesn’t support “collapsing” into a pop-up menu.

This commit does change the category filter to work as a radio button, so if one category is selected, others will be deselected, which I do think makes more sense than the previous behavior of allowing multiple categories to be selected, and using the union of these when filtering.

This commit also retires the xib file. The long-term goal is to eliminate all xib files, as being explicit (in code) is preferred. The xib files only exist because in the past we did not have auto-layout.
2020-04-17 19:19:53 +07:00
Allan Odgaard
266fa8746c Refactoring of file pop-up menu: Use NSDesktopDirectory and NSURL APIs 2020-04-17 19:19:53 +07:00
Allan Odgaard
ff22bb58fa Add allowsEmptySelection to ScopeBarViewController
Also change selectedIndex to NSUInteger as it will be NSNotFound when there is no selection.
2020-04-17 19:19:53 +07:00
Allan Odgaard
36489aa076 Rename (internal) API method
This might be closer to Cocoa naming conventions.
2020-04-17 19:19:53 +07:00
Allan Odgaard
342e612505 Add controlSize to OakScopeBarViewController
Ideally this would be a view property, but the view controller only expose the content view, which is an NSView instance that does not support the property by default, so we would have to introduce a subclass for this.
2020-04-17 19:19:53 +07:00
Allan Odgaard
f8203bccfa Use columnWithIdentifier: instead of tableColumnWithIdentifier:
This simplifies the code.
2020-04-17 19:19:53 +07:00
Allan Odgaard
744219d436 Adjust font size of find window’s status bar to match NSControlSizeSmall 2020-04-17 19:19:53 +07:00
Allan Odgaard
2bdce95293 Refactor OakScopeBarView to be a view controller subclass 2020-04-17 19:19:53 +07:00
Allan Odgaard
3a21cbfd85 Move Go To… menu updating and next/previous actions to ScopeBarView 2020-04-14 12:58:11 +07:00
Allan Odgaard
7d67bb7f80 Add preliminary UI for flagging clipboard history items 2020-04-14 12:58:11 +07:00
Allan Odgaard
b06c34eb0f Refactor helper method to only have a single point of return 2020-04-14 12:58:11 +07:00
Allan Odgaard
7e5daad0ad Add “flagged” property to OakPasteboardEntry
Flagged items will not be implicitly deleted when pruning history or removing all items.
2020-04-14 12:58:11 +07:00
Allan Odgaard
d6ce2e3abf Use tertiaryLabelColor for “replacement characters” in strings
This is instead of lightGrayColor which is not sensitive to light/dark mode.
2020-04-14 12:58:11 +07:00
Allan Odgaard
3668245163 Convert to reference URL for file browser’s “Select Current Document”
This fixes problems with symbolic links, for example file browser may show contents of /private/tmp when we ask to select /tmp/foo.txt. Comparing file path URLs will fail even though /tmp is a symbolic link for /private/tmp.

Note that this fix only works for when the current document is already part of the items in the file browser, as we still store pending URLs to select as file path URLs.
2020-04-14 12:58:10 +07:00
Allan Odgaard
3eaaff7f47 Support selecting multiple items in pasteboard history dialogs
This can either be used to more easily delete multiple items, or for inserting/searching for multiple items.
2020-04-14 12:58:10 +07:00
Allan Odgaard
e0db2f5ec1 Make OakPasteboardEntry’s historyId public 2020-04-14 12:58:10 +07:00
Allan Odgaard
babb989288 Add pasteboard method to store multiple items
This is for multi-selecting items in the pasteboard chooser and they are stored as auto-generated items and with their history identifiers, so that we can treat them as multiple items.
2020-04-14 12:58:10 +07:00
Allan Odgaard
7c78e8316c Support copy/paste of discontinuous selections that contain newlines
Previously we stored discontinuous selections as a newline-delimited string, and therefore the individual fragments could not contain any newlines.

Now that we use NSPasteboard’s multi-string support, we no longer have this limitation.
2020-04-14 12:58:10 +07:00
Allan Odgaard
f2efe71aff Store discontinuous selections as multiple strings on clipboard 2020-04-14 12:58:10 +07:00
Allan Odgaard
34eb6967c8 Use sqlite3 for clipboard history instead of CoreData
I was using the clipboard history as a testbed for CoreData but my conclusion is that it was not a good fit, and with the API we used now being deprecated, and the clipboard history needing various improvements, it’s easier just to replace the CoreData backend with sqlite3 and offers us more flexibility going forward.

With this re-implementation there is now support for storing multiple strings on the clipboard and the check to see if other applications changed the clipboard should work better (it appears that if an application is changing the clipboard while TextMate is active, sometimes the NSPasteboard’s changeCount is not updated).

It now also stores the history item’s row ID on the pasteboard, so if we select the non-latest history item and relaunch TextMate, it will no longer treat the current item on the pasteboard as a new item.
2020-04-14 12:58:10 +07:00
Allan Odgaard
d63f12993f Use class properties for general, find, and replace pasteboard instances 2020-04-14 12:58:10 +07:00
Allan Odgaard
c682655d4a Use readObjectsForClasses: with NSURL instead of NSFilenamesPboardType 2020-04-14 12:58:10 +07:00
Allan Odgaard
e1fdc852e4 Make sure URLs placed on the undo stack are file path URLs
Incase of a file reference URL, moving an item will have the URL resolve to the new file path, therefore such URL cannot be used for storing the old location/path of the item.

This is currently not a problem with TextMate, as all URLs are file path URLs, but as we are moving to using readObjectsForClasses: with NSURL, we will be receiving file reference URLs from Finder.
2020-04-14 12:58:10 +07:00
Allan Odgaard
969c541202 Fix copying files from file browser and pasting in Terminal.app
Terminal.app is peculiar about what it expects to be on the clipboard. If we only write URLs like this:

	[pboard clearContents];
	[pboard writeObjects:urls];

Then it will not paste anything. There *must* be string fallbacks for it to support paste. But if we also write an array of strings like this:

	[pboard clearContents];
	[pboard writeObjects:urls];
	[pboard writeObjects:[urls valueForKeyPath:@"path.lastPathComponent"]];

Then it will paste both the URLs and the strings, but where the URLs will be space-separated, the strings will not. If instead we write a single string fallback only for the first item, like this:

	[pboard clearContents];
	[pboard writeObjects:urls];
	[pboard setString:@"whatever" forType:NSPasteboardTypeString];

Then it will paste the URLs and ignore the string fallback for the first URL.
2020-04-14 12:58:10 +07:00
Allan Odgaard
fec16ec203 Don’t use virtual member functions for clipboard_t::entry_t
There are no subclasses of this type, so no need to make them virtual, and going forward, we will be refactoring how this API works and subclassing will not be supported.
2020-04-14 12:58:10 +07:00
Allan Odgaard
93033c0f47 Add clipboard_t::entry_t constructor taking multiple strings and options
Currently this just moves constructing the options and LF-separating the strings into the clipboard_t::entry_t, but going forward, we will be able to utilize NSPasteboard’s native support for multiple strings (and avoid storing the “fragments” count).
2020-04-14 12:58:10 +07:00
Allan Odgaard
a6258bb625 Snippet pop-up menu would scroll horizontally opposite of the document 2020-04-14 12:58:10 +07:00
Allan Odgaard
31bd361131 Don’t use CommonAncestor to find parent of single file browser item
When CommonAncestor is called with only a single directory then it returns that directory, which meant that searching a selected folder and selecting File Browser → Enclosing Folder would not go up a level (only on second use of this action, would it ascend to the parent folder).

As the CommonAncestor function is used in several places, I didn’t want to change its behavior, but it appears that there are multiple checks in the code to see if “file browser items” only contain a single item, and we just added a new one, so grounds for refactoring.
2020-04-14 12:58:10 +07:00
Allan Odgaard
2e1ed018d4 Query array controller directly for count of objects
The reason we were doing a fetch was because it may provide better performance, furthermore, the count returned by the array controller is count of filtered objects, so this change is a slight regression, should be addressed later.
2020-04-14 12:58:10 +07:00
Allan Odgaard
29f43d2385 Let OakPasteboard create NSArrayController used by clipboard history
Again to hide that we are backed by CoreData storage.
2020-04-14 12:58:10 +07:00
Allan Odgaard
de9c7811de Use filter predicate instead of fetch predicate for clipboard history
This is in anticipation of dropping the CoreData backend.
2020-04-14 12:58:10 +07:00
Allan Odgaard
883a45568f Fix clipboard history predicate string used for filtering 2020-04-14 12:58:10 +07:00
Allan Odgaard
623267ba98 Add API to remove all entries from OakPasteboard
This is one of several steps toward making CoreData an implementation details of OakPasteboard (which it is currently not).
2020-04-14 12:58:10 +07:00
Allan Odgaard
5166b6bfed Introduce constants for clipboard option names 2020-04-14 12:58:10 +07:00
Allan Odgaard
47d0345d5a Omit “default” options argument for clipboard_t::entry_t constructor 2020-04-14 12:58:10 +07:00
Allan Odgaard
a3aa7f3225 Make ‘options’ argument of clipboard_t::entry_t constructor be optional 2020-04-14 12:58:10 +07:00
Allan Odgaard
38305e7fc4 Fix code that should return NO when bundle install is in progress 2020-04-14 12:58:10 +07:00