Commit Graph

2790 Commits

Author SHA1 Message Date
Boris Dušek
afb504b58d Do not use macros for accessibility constants
This improves the chance that someone googling for a certain accessibility
attribute or other accessibility constant in order to find inspiration how to
implement it will find our code in OakTextView. It also makes the code more
understandable for reading by someone else, and generally follows the way
others write accessibility code (including Apple in their code samples). It
does make the code more verbose, but I think that does not outweight the above
advantages.

Inspired by: googling and "githubbing" for NSAccessibilityLinkTextAttribute:
http://lists.apple.com/archives/accessibility-dev/2014/Aug/msg00016.html
2014-08-23 17:45:20 +02:00
Allan Odgaard
87f2c07fbc With no file browser or project folder we try document’s folder
This is for the “untitled save path” which is normally used for new untitled files, so we wouldn’t actually have a folder, however, the property is also used as a fallback for a “project folder” when that property is unset (which it generally shouldn’t be).
2014-08-22 15:54:30 +02:00
Allan Odgaard
881b83cb50 Setup project folder after saving single untitled document 2014-08-22 15:38:21 +02:00
Allan Odgaard
34965c230d Find All for single document: Fix absolute path in search results 2014-08-22 14:58:44 +02:00
Allan Odgaard
bf81caa448 Fix titlecase menu item to say “Line” instead of “Word” 2014-08-22 14:33:02 +02:00
Allan Odgaard
94165739fb Improve capitalization heuristic
See added/updated tests for details.
2014-08-22 14:29:16 +02:00
Allan Odgaard
b0d57705cf Make encoding part of the document_t::reader_t API 2014-08-22 09:35:30 +02:00
Allan Odgaard
b1b0ffda58 Add ‘charset’ property to FFFilePathCell
This is really just a right-aligned label, but we might later change how it’s drawn.
2014-08-22 09:33:41 +02:00
Allan Odgaard
6646a14da1 Use alternate status string to show how many bytes were searched 2014-08-21 17:40:20 +02:00
Allan Odgaard
4b521541d7 Support alternate status string in find dialog window
The alternate string is shown after the user clicks the status bar.
2014-08-21 17:39:13 +02:00
Allan Odgaard
63f8400cc4 Allow specifying an NSTextField subclass when creating labels 2014-08-21 17:37:04 +02:00
Allan Odgaard
50d3a584c9 Track how many bytes we search 2014-08-21 17:36:16 +02:00
Allan Odgaard
4a2a3997cc Update API of find::scan_path_t 2014-08-21 16:50:05 +02:00
Allan Odgaard
2f1c4c05c4 Do not use ‘timeIntervalSinceNow’ with dates in the past
We previously negated the result but now we instead ask for [[NSDate date] timeIntervalSinceDate:startDate].
2014-08-21 16:07:23 +02:00
Allan Odgaard
a06554b638 Minor update of FFDocumentSearch’s instance data usage
Prior to this commit the ‘searchDuration’ property would actually return seconds since we last started a search, rather than how long the last search took.
2014-08-21 16:07:23 +02:00
Allan Odgaard
2908384a24 Add Check/Uncheck All to folder search action menu 2014-08-21 16:07:23 +02:00
Allan Odgaard
ffe3a464f2 Improve implementation of collapsing/expanding search results
We now collapse if more than half the items are expanded, otherwise expand. Previously we relied on a property to track the collapsed/expanded state, which could be out of sync if the user manually changed the state for half the items, and we also needed to reset the state variables when updating search results.
2014-08-21 16:06:34 +02:00
Allan Odgaard
baff330459 Refactor Find in Folder code
Minor functional changes, for example after replacing we keep showing the search results, but with disabled checkboxes and ‘replace all’ button.
2014-08-21 16:06:34 +02:00
Allan Odgaard
153ecda1a5 Rely on compiler synthesized instance variables 2014-08-21 16:06:34 +02:00
Allan Odgaard
bbb61d3b47 Overload description method for FFMatch 2014-08-21 16:06:34 +02:00
Allan Odgaard
573066676d Rely on ARC instead of synthesized accessor
Also give the callback function non-global scope.
2014-08-21 16:06:34 +02:00
Allan Odgaard
2721b22426 Use recede instead of retreat as the inverse of advance 2014-08-21 16:06:34 +02:00
Allan Odgaard
57e43f27e3 Return 0 if Gestalt() fails 2014-08-21 16:06:33 +02:00
Allan Odgaard
f4747e4fe4 Create (find in folder) match excerpt in background thread
Previously these were created on demand, but that meant loading the document in the UI thread. It also meant that multiple matches from same document would cause the document to be read for multiple times.

Furthermore, storing the match excerpt with the find::match_t type should allow for more flexibility, since we no longer need special logic in the table view delegate to load a subset of a document to get the display string, but will simply read it from the record.
2014-08-21 16:06:33 +02:00
Boris Dušek
d7e9b3a41d Use "key equivalent" instead of "shortcut" 2014-08-20 20:56:38 +02:00
Allan Odgaard
920777e2d6 Skip setting (complex) window title when we have no document name
Incase there is no window title settings key then we will set the window title to nil, which throws an exception.
v2.0-alpha.9561
2014-08-18 23:30:20 +02:00
Allan Odgaard
b9fbbfae4a Fix range exception 2014-08-18 23:14:32 +02:00
Allan Odgaard
a3d085a44f Get rid of find::scan_path_matches_t typdef
This is (now) just a std::vector of find::match_t records.
2014-08-18 21:40:58 +02:00
Allan Odgaard
c7346421ce Get rid of redundant mapping of a match in a pair
The pair’s first member (document) is also part of the match data.
2014-08-18 21:36:26 +02:00
Allan Odgaard
91f138c1ae Do not show non-existing locations as having been searched 2014-08-18 18:12:21 +02:00
Allan Odgaard
c032abb7e7 Checkin release notes v2.0-alpha.9559 2014-08-17 22:47:38 +02:00
Allan Odgaard
ecc2f3ad90 Strip ANSI escapes when mate reads from stdin
A warning will be written to stderr when this happens. The user can provide -e/--preserve-escapes to disable the behavior.

Use -e0/--preserve-escapes=0 to suppress the warning.
2014-08-17 22:24:23 +02:00
Allan Odgaard
2e4603bc8c Alphabetize getopt_long() options
This makes it easier to see what letters are still available.
2014-08-17 22:24:23 +02:00
Allan Odgaard
4669dbaa28 Remove commented fprintf statements 2014-08-17 22:24:23 +02:00
Allan Odgaard
babaf4d26e Deselect other when selecting bundle item source with option down 2014-08-15 23:24:13 +02:00
Allan Odgaard
bc31da8f03 Do not set a special initial title for dynamic menu items
Having an initial title that is different from what the user will see makes it harder for them to change the key equivalent, since they most know what this initial title is.

For more info see http://lists.macromates.com/textmate/2014-January/036949.html
2014-08-15 23:24:13 +02:00
Allan Odgaard
60f125eedc Use proper deallocator for SecKeychainItemCopyAttributesAndData 2014-08-15 23:24:13 +02:00
Allan Odgaard
ffa628f328 Opening folder after session restore would not see it as open
When opening a folder we test against the ‘projectPath’ property (on already open window controllers), but this is not setup until we have an open document, and documents are opened using a background queue, so code running in the same event loop cycle as the session restore, will not get the proper value for this property.

The problem this fixes is: open /path/to/foo and quit TextMate. Now drag /path/to/foo to TextMate’s app icon. TextMate would first restore session (which includes /path/to/foo) and then open /path/to/foo (not seeing the restored folder as being /path/to/foo due to the uninitialized ‘projectPath’ property).
2014-08-15 22:37:38 +02:00
Allan Odgaard
54270827ff Opening bundle item chooser will reset selection to first row 2014-08-15 22:37:38 +02:00
Ronald Wampler
df38101798 Use proper deallocator for SecKeychainItemCopyAttributesAndData
This was found using clang's static analyzer.
2014-08-15 15:21:12 -04:00
Allan Odgaard
d39ae2a7df Our grow calculation would fail to grow when given a size of one 2014-08-14 20:37:38 +02:00
Allan Odgaard
b1e40e6203 Fix placement of bundle item chooser when there is no window 2014-08-14 20:37:38 +02:00
Allan Odgaard
fb5a50135a Add status bar to bundle item chooser
This shows the semantic class or scope selector, when we are filtering on that field. Filtering on other fields results in an empty status bar.
2014-08-14 20:37:38 +02:00
Allan Odgaard
c8f6c1d440 Set content hugging priority to high for our buttons
None of our layouts rely on the buttons not hugging their content, so we set the hugging priority so that we do not have to worry about wether or not the constraints capture this requirement.

Curiously, if only the hugging priority is set (to high) for the horizontal orientation then the find dialog can end up with an undesired layout, although all constraints are met.
2014-08-14 20:37:38 +02:00
Allan Odgaard
9062154be5 Bundle item chooser: Disable ‘Edit’ button for menu items 2014-08-14 17:43:27 +02:00
Allan Odgaard
df5b6b7a88 Setup bundle item chooser actions before causing content reload
Triggering a content reload will update the ‘enabled’ state of our buttons. These will be disabled if we have no actions set.

Of course the API should be so that the ‘enabled’ state is also updated when setting the actions, but I am being lazy here.
2014-08-14 17:43:26 +02:00
Allan Odgaard
f88d6f5425 Don’t search for crash reports generated on 10.6 or lower 2014-08-14 17:43:26 +02:00
Allan Odgaard
f1c5d4f581 Learn abbreviations for menu items (in addition to bundle items)
Since the menu item’s title can change (e.g. Word or Selection) and multiple menu items can have the same title (e.g. Tab Size » 4, Toggle Foldings at Level » 4) we store the menu item’s action + tag for the abbreviation.
2014-08-14 17:43:26 +02:00
Allan Odgaard
a6eab1afe6 Use menu item as sender when triggering its action
This is required so that the receiver can ask the menu item (sender) for its tag value.
2014-08-14 17:43:26 +02:00
Allan Odgaard
4a20bfebaa Table cell: Use highlight color for key equivalent / tab trigger
Previously we would use highlight color if the table view was first responder. Now we use the highlight color if the cell’s background is set to NSBackgroundStyleDark, which then works when we use the cell in a table view which “shares focus” with a text or key equivalent field.
2014-08-14 17:43:26 +02:00