Commit Graph

1841 Commits

Author SHA1 Message Date
Allan Odgaard
bf4e1d8cee Find in folder window’s title could switch to “Untitled”
This is because we are using an NSDocument to perform the folder searching (as that’s a decoupled way to have the window indicate “unsaved changes” and present a warning sheet).

The downside is that by using an NSDocument we get some undesired implicit behavior, like automatically changing the window title or trying to re-open the “document” after relaunch.
2014-03-09 10:01:51 +07:00
Allan Odgaard
a4ad676c37 Add debug output to WebView delegate 2014-03-09 10:01:51 +07:00
Allan Odgaard
50ab241838 Open new window for HTML output links with target="_blank"
Since switching to ARC we need to ensure the NSWindow is “over-retained” as we rely on “setReleasedWhenClosed:YES”.

Also add ability to close such windows from JavaScript.
2014-03-09 10:01:51 +07:00
Allan Odgaard
09e5d88437 Refactor OakHTMLOutputView 2014-03-09 10:01:51 +07:00
Allan Odgaard
166bfad140 Fix include paths 2014-03-07 00:10:35 +07:00
Allan Odgaard
c7ae7d1337 Add test for snippets with overlapping fields
See 4e1cdb4c9e for details.
2014-03-07 00:10:35 +07:00
Allan Odgaard
337dc1a221 Update sizing code for snippet pop-up menu
We now rely on the table view to obtain the entries and setup the data cell, which should make the code easier to use for other table views with a different data source implementation.
2014-03-06 10:15:09 +07:00
Allan Odgaard
5e1f86a7c2 Setting disableIndentCorrections to ‘1’ was not treated as :true 2014-03-06 10:15:09 +07:00
Allan Odgaard
0e16132725 Bundle item chooser key equivalent search now sort based on scope
For example searching for items bound to ⌃H will show the fallback item in the Shell Script bundle last (as it’s not scoped). Previously items were alphabetized.
2014-03-05 21:18:59 +07:00
Allan Odgaard
6ded0873a3 Remove (somewhat) redundant code 2014-03-05 21:18:59 +07:00
Allan Odgaard
8e63d2729f Setting current pasteboard entry to itself lose auxiliary options
An example where this is desired is when doing a folder search for “foo”, then going to first match and using ⌘E to copy the match to the find pasteboard. This is effectively a no-op except for dropping the auxiliary options that contain other documents with matches (which is what causes ⌘G to advance to next document).
2014-03-05 21:18:59 +07:00
Allan Odgaard
c5c88843e8 Let OakFileIconImage be lazy wrt. stat’ing and obtaining SCM info
There are situations where we create an OakFileIconImage that won’t be drawn, for example when using it with an NSMenuItem. In that case, we previously paid a somewhat noticeable price in the initializer doing work that was not required.
2014-03-05 16:39:55 +07:00
Allan Odgaard
83aabbf53c Move properties from OakFileIconImageRep to OakFileIconImage 2014-03-05 16:39:55 +07:00
Allan Odgaard
1e11a30a53 Remove redundant storage keywords for @property
These were required prior to the new 64 bit run-time.
2014-03-05 16:39:54 +07:00
Allan Odgaard
947b352952 Set pasteboard history search field to fire immediately 2014-03-04 10:40:05 +07:00
Allan Odgaard
a6f6185123 Add NSError info to crash report 2014-03-04 10:24:05 +07:00
Allan Odgaard
c38a1a64af Add to_s overload for NSError 2014-03-04 10:23:01 +07:00
Allan Odgaard
1840f5b7fa Improve utf8::find_safe_end implementation
Previously calling the function with invalid UTF-8 could cause it to iterate over all the data and, if built in debug mode, could cause an assertion failure.

Now we return the sequence’s end when the data appears to be malformed and we never look at more than the last 6 bytes in the sequence.
2014-03-03 13:48:12 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
1781f4a605 Use proper iterate macro for temporary 2014-03-03 00:20:02 +07:00
Allan Odgaard
d700447d8b Remove unused API 2014-03-02 21:10:15 +07:00
Allan Odgaard
be92d71c46 Allow disabling indent corrections when typing on empty lines
This is generally desired when the indent of a new line does not (necessarily) depend on lines above it, but where we otherwise do want indent corrections, e.g. HTML.
2014-03-02 20:06:31 +07:00
Allan Odgaard
a180c24539 Run will/did save and activate/deactivate callbacks in sequence
Previously only the most specialized callback(s) would run. For example creating a command scoped to “source” with “callback.document.will-save” for semantic class would never run for Ruby, Python, etc. because the Source bundle has a “Make Script Executable” callback scoped specifically to “source.ruby”, “source.python”, etc.
2014-03-02 13:15:34 +07:00
Allan Odgaard
4609378cdc Introduce bundles::kItemTypeMost constant 2014-03-02 13:13:04 +07:00
Allan Odgaard
e71be609e0 Use new pasteboard history browser
Closes #481
2014-03-02 12:13:06 +07:00
Allan Odgaard
0e0a6e0252 Fallback on system pasteboard when history is empty
This is for the next/previous methods, the method that returns current already would fallback on the system pasteboard.
2014-03-02 12:13:06 +07:00
Allan Odgaard
95508d9757 Add new pasteboard history browser 2014-03-02 12:12:57 +07:00
Allan Odgaard
34d9a6770f Add API to (temporarily) disable session saving 2014-03-01 08:48:28 +07:00
Allan Odgaard
7483829245 OakPasteboard: Setting currentEntry now updates system clipboard 2014-02-28 19:20:21 +07:00
Allan Odgaard
72f4811d0b Use @property with @dynamic for ‘primitiveOptions’ property 2014-02-28 19:18:28 +07:00
Allan Odgaard
c0c8a073b9 Avoid property access in fetch predicate 2014-02-28 14:33:20 +07:00
Allan Odgaard
79a47ee277 Don’t store pasteboard entries in an ordered collection
Instead we date stamp each entry and do a sorted fetch (with a limit of one) to find next/previous entry (when required).

The reason for moving away from an ordered collection is twofold, the main reason is that NSArrayController does not support ordered collections, so we lose one of the advantages of switching to CoreData. The secondary reason is that using an ordered collection requires that we use an index for “current item” (or maybe liberal use of indexOfObject:) and it’s problematic to ensure that the index is kept 100% in sync with the entries in the collection (especially with bindings and delayed actions).
2014-02-28 14:28:03 +07:00
Allan Odgaard
13e810e8be Add exception handler for NSManagedObjectContext’s save: method
If an exception is thrown, a dialog is shown. This isn’t very user friendly, but the goal is to call attention to the problem, as I wouldn’t expect any exceptions to be thrown by this method, but I have seen multiple “optimistic locking failure” exceptions despite single-app / single-thread access to the persistent store.
2014-02-27 12:36:33 +07:00
Allan Odgaard
c9f1cd2a84 Enable “Uncommitted Documents” in file chooser 2014-02-27 11:41:26 +07:00
Allan Odgaard
2389e2c589 Recreate SCM info when re-opening file chooser
This is required for showing SCM status for “Open Files”. Previously, closing the file chooser with “Open Files” selected and re-opening it, would not have SCM info for the open files.
2014-02-27 11:30:45 +07:00
Allan Odgaard
56ae96982d Refactor file chooser source selection 2014-02-26 23:00:59 +07:00
Allan Odgaard
1a4314fce2 Wrap initialize code in dispatch_once
This is only done for code where running it twice would actually cause a problem.

Dispatch_once is favored over a static boolean only because it seems to carry slightly more semantic information.
2014-02-26 19:36:54 +07:00
Allan Odgaard
0663a39bcf Abort copy file if target is child of source 2014-02-26 08:29:42 +07:00
Allan Odgaard
4e1cdb4c9e Snippets with overlapping fields could cause multiple carets
For example in ruby inserting ‘env⇥’, deleting the initially selected letter, and typing B or S, would insert an additional caret (it was actually inserted in the previous step, but not visible since it was overlapping the existing caret).

The API lack proper support for returning the new caret range so we are using a heuristic to figure out which of the returned ranges correspond to our caret. Ideally the API would be updated.
2014-02-26 08:29:42 +07:00
Allan Odgaard
6ec2f26d2c Don’t access user’s contacts during launch
Instead we access it when either we need to submit a crash report, when the preferences window open (where the contact address is shown), or when creating a new bundle (where email is also used for the bundle’s contact).
2014-02-23 17:10:31 +07:00
Allan Odgaard
4c09310c14 Update Projects preferences pane, adding 3 new options 2014-02-23 14:45:26 +07:00
Allan Odgaard
faedd67299 Move some user defaults keys to Preferences/Keys.h 2014-02-23 13:36:47 +07:00
Allan Odgaard
3baea707e2 Fix typo 2014-02-23 08:33:38 +07:00
Allan Odgaard
ae26988b39 If any folding pattern is set as a scoped setting, use it
Previously we would fallback on the grammar’s folding patterns unless ‘foldingStartMarker’ was set, which meant setting just the stop marker or indented folding patterns, would be ignored.
2014-02-22 16:00:00 +07:00
Allan Odgaard
60e8af92e4 Delay saving of pasteboard history by 30 seconds
Since we save the history during applicationWillTerminate: there is (in theory) no reason to periodically save the history, but in case of a crash or similar, we would not get to applicationWillTerminate:.
2014-02-22 15:51:45 +07:00
Allan Odgaard
9fcde0791e Add CoreData index to pasteboard entry content 2014-02-21 22:04:02 +07:00
Allan Odgaard
8b44ab2c41 Avoid duplicate entries on find/replace pasteboard 2014-02-21 21:36:13 +07:00
Allan Odgaard
fbafcfb87e Ignore links when recursively expanding file browser items
Symbolic links can point to ancestor items and cause cycles, which would cause the (recursive) expansion to newer terminate.
2014-02-21 11:51:11 +07:00
Allan Odgaard
4015859bd3 Allow inline expansion of symbolic links (in file browser)
This is enabled by running: defaults write com.macromates.TextMate.preview allowExpandingLinks -bool YES
2014-02-21 11:48:34 +07:00
Allan Odgaard
8956207789 Avoid detached objects in core data store 2014-02-20 22:40:20 +07:00