Commit Graph

229 Commits

Author SHA1 Message Date
Allan Odgaard
c416262d82 Limit FFMatch / find::match_t boxing and unboxing 2015-03-05 16:38:09 +07:00
Allan Odgaard
40879d5683 Replace sizeofA macro with range-based for loop or std::begin/end 2015-03-05 16:38:09 +07:00
Allan Odgaard
b4ee16312b Revert "Output frame of find window’s field editor (debug)"
This reverts commit 3d2ac7f371.
2015-01-31 12:05:44 +07:00
Allan Odgaard
812f8146bf Only limit regexp search to 5 MB when operating on disk file
That is, if the file has been opened by the user, there is no size limit on what we will search.
2015-01-29 14:37:56 +07:00
Allan Odgaard
49b784f09c Fix bad logic in if statement
Effectively we would only test if the prefix of a search result was malformed UTF-8, if the search result itself or the suffix was malformed, no error would be shown.
2015-01-21 15:47:27 +07:00
Allan Odgaard
a1a8205467 Find in folder excerpt would be one byte too short for last line
Since it was one byte it would throw an exception if the last character on the line was a multi-byte sequence (as we’d create an NSString with malformed/truncated UTF-8).
2015-01-21 15:38:33 +07:00
Allan Odgaard
29a576ffbe Don’t go via helper for pthread_setname_np
This was previously done because the function wasn’t available until 10.7, but since that is (now) our deployment target, there is no need to wrap the call.
2014-12-25 09:36:01 +01:00
Allan Odgaard
43ab10e45c Increase content compression resistance from high to required
The auto-layout debug mechanisms report that our layout is ambiguous, for example if inserting ‘[self.window visualizeConstraints:_myConstraints]’ at the end of showWindow:.

Closes #1282
2014-12-17 10:13:52 +07:00
Allan Odgaard
bf4cbd33fa Remove NSString* typecast when using to_s helper
This has a small run-time cost but source looks better and theoretically safer code.
2014-11-29 09:53:40 +07:00
Allan Odgaard
a4763ac96c Be smarter about testing if replace text field has focus
Rather than skip the field editor, regardless of which view it belongs to, we check if the first responder is the replace text field’s (current) field editor.
2014-11-29 07:55:48 +07:00
Allan Odgaard
3d2ac7f371 Output frame of find window’s field editor (debug) 2014-11-21 15:17:39 +01:00
Allan Odgaard
5b39bdc98b Remove double semi-colons at end of line 2014-11-14 10:21:34 +01:00
Allan Odgaard
e5009c8415 Remove next/previous properties on result (tree) node
We can get to the next/previous node via the parent pointer, although it has worse time complexity, it’s not something we use in loops, so the extra bookkeeping is not worth it.
2014-11-14 10:20:15 +01:00
Allan Odgaard
2e049ad25f Replace newline and tabs in find dialog’s status text
Previously if searching for something with a newline, the status text would show a literal newline and adapt its height.
2014-11-10 09:24:10 +01:00
Allan Odgaard
ec89bd035b Ensure valid match/excerpt ranges for CRLF delimited files
When searching for either CR or LF in a CRLF delimited file, we effectively match a partial newline and previously the excerpt’s BOL/EOL positions would not take that into account, so the match wasn’t guaranteed to be a subset of the excerpt.

Ideally the document reader should harmonize newlines so that the searcher only sees LF, though currently that is not the case.
2014-11-10 09:22:52 +01:00
Allan Odgaard
7d2ed9a236 Set initial first responder when setting up key view loop 2014-11-06 16:42:22 +01:00
Allan Odgaard
7aea556533 Remove custom NSArray category
We only use the firstObject method which has existed since OS 10.6 (though wasn’t mentioned until the 10.9 FoundationKit release notes).
2014-11-05 10:58:29 +01:00
Allan Odgaard
b581e20ad9 Add wrapper for adding views with auto layout enabled 2014-11-05 00:09:37 +01:00
Allan Odgaard
7ead6d418c Make the OakCreateLabel function more versatile 2014-11-04 22:22:57 +01:00
Allan Odgaard
137e6343ba Add convenience function to setup key view loop 2014-11-04 21:42:09 +01:00
Allan Odgaard
141f8009ac Skip recreating replacement preview if nothing has changed 2014-10-20 22:40:44 +02:00
Allan Odgaard
cf94c1c5ca Clear search gutter marks if find clipboard is changed 2014-10-19 20:26:00 +02:00
Allan Odgaard
e934d3ab2e Show number for search results when holding down command key
The number appears after command has been held down for 0.2 seconds and is meant as a hint about being able to press ⌘1-n to jump to the n’th file with matches.
2014-10-19 20:26:00 +02:00
Allan Odgaard
e22651f9d8 Add replace button to find dialog 2014-10-18 13:38:11 +02:00
Allan Odgaard
9c9de99418 Verify checksum when replacing in non-open documents
If the checksum does not match we simply skip the document and does not show the replacement as having been done (in the UI).
2014-10-18 13:03:01 +02:00
Allan Odgaard
053b08456f Use a real content checksum when doing folder searching 2014-10-18 13:03:01 +02:00
Allan Odgaard
207c642614 Use number formatter for all numbers in search dialog 2014-10-17 15:28:03 +02:00
Allan Odgaard
7bdbc4985a Clear search marks from documents if removed from search results 2014-10-15 17:08:19 +02:00
Allan Odgaard
c672759acb Improve handling of replacement previews
We no longer do any reloading of the outline view (on changes) and we have the item store the replacement string when a replacement has been done, so that it will continue to show the actual replacement done (after replacement string is changed).
2014-10-15 17:02:22 +02:00
Allan Odgaard
aa18a55b20 Remove performedReplaceAll property
This only served to disable the Replace All button, we now rely solely on the number of non-excluded and non-ignored results to control the enabled state of the button.
2014-10-15 17:02:22 +02:00
Allan Odgaard
63207a960c Rely on the ‘ignored’ property for whether replacements are done
We now bind the enabled state of the “exclude result” checkbox to this property and only set it to YES for files that had replacements done, meaning that the checkboxes are available after replace for files that weren’t involved in the replacement.
2014-10-15 17:02:22 +02:00
Allan Odgaard
33c9a2b919 Check if all matches are excluded before iterating through them 2014-10-15 17:02:21 +02:00
Allan Odgaard
8de8291afe Add ignored property to FFResultNode
When a group node is ignored then it report all its children as excluded regardless of their actual state. It is still possible to query the children for the real state.
2014-10-15 17:02:21 +02:00
Allan Odgaard
e2ab281343 Define excluded property for FFResultNode child nodes
This returns YES when all leafs are excluded.
2014-10-15 15:37:07 +02:00
Allan Odgaard
4f807fd109 Make countOfLeafs/Excluded a readonly property 2014-10-15 15:35:54 +02:00
Allan Odgaard
826437a2ef Introduce constant for search mark identifier 2014-10-15 10:28:18 +02:00
Allan Odgaard
bb6206608b Use text::pos_t as key when storing marks for closed documents
Since open documents only support a single position (not a range) it doesn’t make sense to use a range for closed documents.
2014-10-14 22:53:10 +02:00
Allan Odgaard
b569af3ff0 Fix display path when searching open files 2014-10-13 23:20:25 +02:00
Allan Odgaard
b876a6a577 Remove “Unsaved Changes” warning from find in folder dialog 2014-10-08 22:05:20 +02:00
Allan Odgaard
e4f62343f6 Save immediately after folder search‘n’replace on closed document 2014-10-08 22:03:48 +02:00
Allan Odgaard
74ae2b21dd Bump document revision after doing folder search and replace
Without this, the document would not appear as modified (if it wasn’t already).
2014-10-08 21:51:17 +02:00
Allan Odgaard
591876f3f2 Introduce FFResultsViewController
This moves a lot of view related code out of the Find singleton.
2014-10-08 12:23:56 +02:00
Allan Odgaard
23a66a40b9 Move FFResultNode to its own file 2014-10-07 22:27:59 +02:00
Allan Odgaard
4d0f4b4c03 File names in search results stay dark gray (and bold)
Since the headers use a bigger font size than the document excerpts, making file names both black and bold, like the matches, makes them too dominant.
2014-10-07 19:10:27 +02:00
Allan Odgaard
197222f93e Disable find action buttons when there is no find string 2014-10-02 11:03:40 +02:00
Allan Odgaard
c080a5d5d3 Use NSNegateBooleanTransformerName constant instead of string 2014-10-02 11:03:40 +02:00
Allan Odgaard
63dcc93ab4 Introduce table cell view subclass to avoid expensive reload 2014-09-30 17:05:53 +02:00
Allan Odgaard
106ac62bcf Use OakStatusBarFont() for find window’s status text 2014-09-30 16:58:12 +02:00
Allan Odgaard
11de15ac54 Update fonts used for find in folder results
We now use the control content font as this seems to be meant for content shown in tables. We use the standard size (of 12 points) for the headings and set the result rows to use 11 point.

The number of matches is shown with the label font as that is semantically a small font used for placing labels next to things.
2014-09-29 22:41:54 +02:00
Allan Odgaard
d1dd666fbd Remove remains from cell-based find results outline view 2014-09-29 15:12:23 +02:00