Commit Graph

61 Commits

Author SHA1 Message Date
Allan Odgaard
45dc49eb29 Retire compiler workaround
Previously we could get a compiler error when using std::map<std::string, std::string>() as a default argument.
2013-03-16 17:49:49 +01:00
Allan Odgaard
d8cf1e3591 Gather UI construction code and harmonize fonts 2013-03-13 12:38:11 +01:00
Allan Odgaard
9f8b7bf27c Improve layout constraints for labels
The widest should now be exactly 20 pixels from the window’s left border, and the others are right-aligned with this label.
2013-03-13 12:37:23 +01:00
Allan Odgaard
b5136bcdc7 Set window’s defaultButtonCell
This is instead of setting the key equivalent to ‘\r’ for the button that should be default.
2013-03-13 12:37:22 +01:00
Allan Odgaard
c44e85f258 Avoid delayed window resize 2013-03-13 12:37:22 +01:00
Allan Odgaard
7acf168904 Keep title and enabled state of Replace All button updated 2013-03-13 12:37:22 +01:00
Allan Odgaard
f553f20cc7 Change criterion for focusing find string when dialog is open
We now move focus to the find string unless the window is visible, key, and focus is already in a text field (technically an NSTextView).
2013-03-13 12:37:22 +01:00
Allan Odgaard
db5df4a58c Update Find window API 2013-03-13 12:37:22 +01:00
Allan Odgaard
df512d98fa Remember height of find in folder results 2013-03-12 10:25:04 +01:00
Allan Odgaard
59fb3bc1a9 The ⌘1-n keys wouldn’t always work in find dialog 2013-03-10 14:34:44 +01:00
Allan Odgaard
ee2c2b33fb Fix potential deadlock when opening find window
The Find object is assigned to a variable with (guarded) static storage, so the initializer of the Find object will run with a lock on the guarded variable, which turns out to be shared with all other guarded variables.

When setting up the window controller, from the Find object’s initializer, we create a “recent folders” menu which hold icons with SCM badges.

When creating these SCM icons, blocks are scheduled (asynchronously) to “fetch status”. These asynchronous blocks will need to lock the same mutex as we currently have locked (because we haven’t yet left the initializer).

The issue is that we also schedule synchronous blocks on the same queue, and that’s why we get a deadlock, because those can’t run before the asynchronous blocks have finished, yet those are waiting on the global lock that our main thread has currently obtained.

Fixes #874.
2013-03-07 22:03:50 +01:00
Allan Odgaard
14cfedb287 Implement Replace [and Find] bound to ⌥⌘G
Currently this is implemented in OakTextView which means that it doesn’t work for macros. Some refactoring is in order so that the implementation can be shared (lack of sharing has to do with how OakTextView reports status to Find dialog or via tool tips, and macros want none of that).

There is also no check to see if the current state of the editor is the result of a find operation, i.e. you can invoke “replace” regardless of wether or not “find” was the last action.

Finally, doing a multi-file search and using “find next” at the end of one document, which brings you to the first match of next document (part of the results), will not update “captures” from a potential regular expression search, meaning that if you then do “replace”, and your replacement string is a format string that references the match (via $1-n) then it will not be correctly expanded.

Closes #104.
2013-03-07 16:21:57 +01:00
Allan Odgaard
02f32977f2 Introduce Replace [and Find] in find protocol
Previously there was a single replace action and the options would indicate if it was a “replace all”, this mimics the “find” (which can be a “find all”) but since single match replacement is somewhat different than a “replace all”, as the former may need to know the captures from a previous find action, it makes sense to factor out these things as different actions.
2013-03-07 16:21:47 +01:00
Allan Odgaard
599d903eb4 ARC: Update Find framework 2013-03-07 10:50:41 +01:00
Allan Odgaard
4a24d0ad58 Rework find dialog (part one)
This is work in progress but I don’t think any functionality is missing compared to previous commit, although some functionality might be less polished, e.g. the action buttons don’t properly enable/disable and the height of the results list gets lost when hiding it.

Some of the stuff that has changed / improved:

 * The find/replace text fields adjust their height to encompass the content (closes #94). Presently though the initial height of the ontrols is one line regardless of content (but they should adjust on first edit).
 * You can use Save All (⌥⌘S) to save affected files after Replace All (closes #558).
 * The key equivalents / actions available in the Find dialog is now easier to find via the action pop-up, which also has enables accessibility.
 * Using Next (⌘G) or Previous (⇧⌘G) with search results will move selection up/down.
 * Using Find All with ‘in’ set to ‘Selection’ will find and select all matches in the current document, which fixes #425, though it might be more desirable to show the results in the find dialog (like Find All does for a document or folder).
2013-03-07 10:50:19 +01:00
Allan Odgaard
699d0676b3 Add to undo stack when replacing after folder search
Fixes #536.
2013-03-03 23:19:34 +01:00
Allan Odgaard
6d6c3e4de6 Use path::is_absolute instead of custom code 2013-02-25 15:25:17 +01:00
Allan Odgaard
e62ef9cf6d Re-use file icon image
These are expensive to create and it was noticeable when lots of files matched and the menu had to be created (as it would when the user press a potential menu key like ⌘W).
2013-02-18 15:38:25 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
8265a469d8 Improve locating Find framework resources
The FFWindowController class is an implementation detail where the Find class is the public class, so depending on the latter should make the code safe against potential rewrites.
2013-02-04 19:38:31 +01:00
Allan Odgaard
f57b06fa2c Move instance variables to implementation 2013-02-04 19:38:00 +01:00
Allan Odgaard
645f8d91e1 Let OS handle keys for Go to Tab submenu
My memory is a little vague here, but I believe the point of handling the menu keys was to workaround a bug in NSMenu.

The bug was that NSMenu would look at (the target of) cached menu items, probably for UI validation, so potentially sending methods to unretained objects, which could lead to a crash. Several workarounds were attempted (like clearing the target property after the menu had been displayed) but the only effective one was overloading key handling.

I’m quite sure though that this bug is no longer relevant.
2013-01-22 11:00:27 +01:00
Allan Odgaard
54f1343ca2 Folder search now reads all relevant exclude patterns
Previously it wouldn’t read kSettingsExcludeDirectoriesKey and kSettingsExcludeFilesKey.
2013-01-13 11:56:06 +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
d96dbc4269 Clicking a ‘find all’ result would be handled twice
Normally this wouldn’t be noticed, as the second action would do the same as the first (go to the result in the associated project window), but when there was no project window a new window opens (to show the result), and that would be done twice.

This fixes issue #281.

There is still an issue with successive selections for the “no project window” situation, as each time, a new window is opened, rather than reuse the first one that opened.
2013-01-08 22:48:07 +01:00
Allan Odgaard
9c35f445de Convert strings files to UTF-8 2013-01-02 01:46:48 +01:00
Allan Odgaard
47fa0f040c Use Objective-C literals for YES/NO 2013-01-02 01:46:48 +01:00
Allan Odgaard
c273b3d4fe Set Find and Go to Line dialogs to “join active space”
If user opens the dialog on one space, moves to another space (with a TextMate window) and then re-activate the (already open) dialog, it would previously switch back to the space containing the dialog, whereas with the changed setting, it now moves the dialog to the active space.

This should address issue #599.
2012-12-30 04:35:47 +01:00
Allan Odgaard
71be61cbbb Enable ARC by default
We now explicitly disable it for targets that hasn’t yet been upgraded to ARC. This way, it’s easier to get an overview of which targets hasn’t yet been upgraded and ensures new targets has ARC enabled.
2012-12-19 19:42:36 +01:00
Allan Odgaard
1eb54282af Move attr_string.h to Find framework 2012-12-19 19:42:35 +01:00
Allan Odgaard
921efb9f6e Don’t link with QuartzCore
This was originally done for CoreAnimation (which is no longer used).
2012-10-24 21:07:21 +07:00
Allan Odgaard
983bce86aa Use @autoreleasepool blocks 2012-09-25 12:30:12 +02:00
Rasmus Abrahamsen
ccc0b414bb Fix “replace selected” for Find All in document
Fixes issue #77.
2012-09-24 20:58:42 +02:00
Rasmus Abrahamsen
443421be84 Fix CRLF issue #409. 2012-09-24 20:58:41 +02:00
Allan Odgaard
9d97fdfdb0 Find in Folder: Add failing CRLF test 2012-09-24 20:58:41 +02:00
Allan Odgaard
0cea361b00 Explicit timer invalidation 2012-09-22 13:23:41 +02:00
Allan Odgaard
8fd7b82cbd Remove CocoaSTL.h include 2012-09-20 12:22:20 +02:00
Allan Odgaard
4273bf968b Get rid of C++ style NSIndexSet iteration 2012-09-20 12:22:19 +02:00
Allan Odgaard
6b42343bd3 Add missing include 2012-09-20 12:22:19 +02:00
Allan Odgaard
2ba66c5718 Add four flavors of copy to find in folder window
These actions are available from the settings / action menu in the status bar above the results.

Calling the regular copy (⌘C) copies the entire lines. Probably it should only copy the matching subset when a regular expression search has been performed.
2012-09-19 02:13:53 +02:00
Allan Odgaard
1fafbecd54 Remove Chinese translation
It’s not feasible to maintain the old-style xib translations while we work on the UI. We’ll soon move fully to constraint-based layout which should allow translations to be purely string-based.
2012-09-16 11:41:23 +02:00
Allan Odgaard
a14a13feff Update search and file chooser to new glob list 2012-09-12 18:30:36 +02:00
Allan Odgaard
4fc00f55e7 Update file scanner API to use glob_list_t 2012-09-12 18:30:36 +02:00
Allan Odgaard
6f2e6bb3e5 Don’t restore “search hidden folders” setting
This is only because of upcoming code changes. Wether or not to search hidden folders can be expressed using the glob list, so a dedicated setting is redundant.
2012-09-12 18:30:36 +02:00
Jacob Bandes-Storch
dfdde3283f Use 64-bit: explicit visibility where required 2012-08-28 21:32:47 +02:00
Jacob Bandes-Storch
b675c78909 Use libc++: avoid incomplete types where needed 2012-08-28 20:17:29 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
3c79f275f1 Use constants for settings keys 2012-08-23 17:15:12 +02:00
Jacob Bandes-Storch
a611fc213d Prevent horizontal scrolling of search results 2012-08-22 15:01:37 +02:00
Jacob Bandes-Storch
b24f2294fb Clean up find results view positioning
The left and right borders are no longer visible, so the results are flush with the edges of the find window.
2012-08-22 14:43:09 +02:00