Commit Graph

330 Commits

Author SHA1 Message Date
Allan Odgaard
b45ad48c00 Add attr.project.vagrant and attr.project.jekyll scopes
The latter is added when we detect a ‘_config.yml’ file in the project. This might cause false positives, but I am not aware of a better way to detect jekyll projects.
2014-05-17 13:21:53 +07:00
Allan Odgaard
49f746e795 Update saved per-window project state when terminating TextMate 2014-05-17 13:21:53 +07:00
Allan Odgaard
42888110fb Add ‘saveOnBlur’ as a .tm_properties option
This makes it easier to enable auto-saving when TextMate loses focus and unlike using a command for this, files that cannot be saved will be silently skipped (as the user is leaving TextMate, so we should not throw up dialogs).
2014-05-16 22:11:28 +07:00
Allan Odgaard
8919ad3461 Remove duplicate code 2014-05-16 22:11:28 +07:00
Ronald Wampler
3ed4722a80 Remove duplication of find_tags enumeration 2014-04-30 12:09:46 +07:00
Allan Odgaard
978ec97ecf Revert "Do not abort application shutdown when we need to save documents"
This reverts commit 73f82c6c5c.

Conflicts:
	Frameworks/DocumentWindow/src/DocumentController.mm
2014-04-29 06:59:39 +07:00
Allan Odgaard
7fb02603b5 Revert "Disable threaded saving as a workaround for stall during quit"
This reverts commit 0b41947412.
2014-04-29 06:59:39 +07:00
Allan Odgaard
0b41947412 Disable threaded saving as a workaround for stall during quit
The problem is that during quit the OS will run a local event loop until we reply to the terminate event. In this local event loop we cannot use performSelector:withObject:afterDelay: but that is required to not block the main dispatch queue.
2014-04-28 21:45:59 +07:00
Allan Odgaard
17b5928d76 Remove backup files for documents with a path during quit
Previously if we selected “Don’t Save” the discarded changes would still be there after relaunch.
2014-04-28 18:23:51 +07:00
Allan Odgaard
b8c1085b9e Let NSURL extract the host from REST_API
The custom code in network::can_reach_host only dealt with the scheme, not port number or user/password.
2014-04-28 18:23:50 +07:00
Allan Odgaard
397fdb52d4 Make REST_API a global define and make it a C string 2014-04-28 18:23:50 +07:00
Allan Odgaard
7c31761e21 Use NSWindow’s stringWithSavedFrame instead of window.frame
This includes the screen dimension so that restoring the frame on a different screen can scale the window accordingly.
2014-04-25 16:55:31 +07:00
Allan Odgaard
fcae942927 Fix comparison of document path with candidate name
This check is so that we always include the current document, even if the exclude/binary globs are setup to exclude it.
2014-04-18 06:39:28 +07:00
Allan Odgaard
7c6594012e Use initializer list to create std::set (C++11) 2014-04-18 06:39:28 +07:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +07:00
Allan Odgaard
5e96775fa3 Break out of current block before continuing document saving 2014-04-12 20:33:30 +07:00
Allan Odgaard
09d9cf9bd2 fixup! Add setting to disable tab re-ordering 2014-04-11 10:57:10 +07:00
Allan Odgaard
b06474fbac Introduce ‘hideStatusBar’ user defaults key 2014-04-10 17:46:31 +07:00
Allan Odgaard
ba87a43c66 Workaround for “did save” commands stalling TextMate
This became an issue after 10d9464.
2014-04-09 15:15:36 +07:00
Allan Odgaard
6d1da8ce97 Use bundle item’s effective name in error and cancel sheets
For example the bundle item “Execute Line / Selection” will (without a selection) show as “Execute Line” in the menu, and now also if the command causes the error sheet to appear or the user press ⌃C / ⌘. to prematurely kill it.
2014-04-09 15:15:36 +07:00
Allan Odgaard
38b91da708 Selecting “Save” during quit would lose untitled documents 2014-04-08 16:33:57 +07:00
Allan Odgaard
73f82c6c5c Do not abort application shutdown when we need to save documents
This was previously necessary because we do threaded saving and relied on our run-loop source to be notified when saving completed, but as application termination (presumably) causes TextMate to run in a special run loop mode, we would not receive this notification.

After switching to dispatch queues there no longer is a problem (at least on OS X 10.9.2).

Closes #1030
2014-04-08 16:33:57 +07:00
Allan Odgaard
b0864281ed Add “New Document” as output option for Filter Through Command 2014-04-08 15:43:19 +07:00
Allan Odgaard
6cc0108961 Rename document_t:{open,save} → document_t:sync_{open,save}
This makes it easier to search for code that use these functions.
2014-04-07 17:28:41 +07:00
Allan Odgaard
575c31b66f Fix error message for command requirements with no variable 2014-04-05 14:13:39 +07:00
Ronald Wampler
960b41297b Export TM_SCM_NAME and TM_SCM_BRANCH
This will be used by OakCommitWindow.

Also removed extraneous whitespaces.
2014-04-03 15:44:39 +07:00
Allan Odgaard
04cd55303a Ensure we have a document in tab drop action method
Some crash reports indicate that we do not have a document, although I can’t think of why such situation would arise.
2014-03-31 08:27:18 +07:00
Allan Odgaard
1377e34bb5 Fix deadlock related to aborting command with HTML output
This would happen for a command that is set to re-use previous output window (when busy). We would kill the running command and wait (in the main dispatch queue) for it to stop, but since the runner is (now) using GCD as well, and updating the “did exit” status in the main queue, we would wait forever.
2014-03-31 08:27:17 +07:00
Allan Odgaard
d985a83845 Use runner_t::wait_for_command instead of runner_t::wait(true)
The latter API has been removed.
2014-03-29 09:57:09 +07:00
Allan Odgaard
5f69ef31c7 Don’t use NS prefix for custom functions 2014-03-28 19:31:14 +07:00
Allan Odgaard
c758c9296f Remove unnecessary check in menu item validation
Since the HTML output window responds to toggleHTMLOutput: we would never be called when that window is key.
2014-03-28 10:19:05 +07:00
Allan Odgaard
080dd3da18 Add showWindow:/close methods for HTML output window controller
These must be used for proper management of the “retainedSelf” property.
2014-03-28 10:19:05 +07:00
Allan Odgaard
6535546c87 Use view’s undo manager rather than the window’s 2014-03-26 15:30:36 +07:00
Allan Odgaard
73453e5152 Do not restore project state for projects with no documents
The state being restored here would be file browser state, which might confuse the user if they are opening a folder via “mate” and then get a file browser restored for that project folder that show another location than the actual folder they open.

The reason we ignore the state when loading, rather than not saving it in the first place, is that by saving the state we make the folder show up in File → Open Favorites…
2014-03-25 12:19:58 +07:00
Allan Odgaard
2a36fed4d8 Handle output window re-use options for commands 2014-03-10 09:39:52 +07:00
Allan Odgaard
e318ee0519 Refactor: Collecting output windows moved to own method 2014-03-10 09:39:52 +07:00
Allan Odgaard
16c09c2a92 Update API to reflect that setting command runner can’t fail 2014-03-09 17:13:57 +07:00
Allan Odgaard
3e603dd238 Show alert sheet when closing window with a running command
This only applies to commands being run embedded in the document window.
2014-03-09 17:13:57 +07:00
Allan Odgaard
69453cd1fc Do not re-use busy HTML output views/windows
Additionally, we only re-use a window when the command is the same as what was last associated with the window. So doing a documentation lookup and then building the project will not re-use the (non-busy) documentation window for the build progress.

Closes #733
2014-03-09 10:01:52 +07:00
Allan Odgaard
09e5d88437 Refactor OakHTMLOutputView 2014-03-09 10:01:51 +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
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
34d9a6770f Add API to (temporarily) disable session saving 2014-03-01 08:48:28 +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
faedd67299 Move some user defaults keys to Preferences/Keys.h 2014-02-23 13:36:47 +07:00
Allan Odgaard
95b834ac0a Grammars with no root scope are no longer shown in the UI
Only injection grammars should have an empty root scope, and if so, it does not make sense to allow the user to pick it as document grammar.
2014-02-20 13:14:36 +07:00
Allan Odgaard
162ba1649c Rename project-state.db → RecentProjects.db 2014-02-19 18:01:00 +07:00
Allan Odgaard
c7462eedd7 Allow disabling folder state restore
Presently this will also disable it if the folder is opened via the Recent Projects chooser. Ideally opening via this list should not disable folder state restoring.
2014-02-11 14:23:34 +07:00
Allan Odgaard
bef5e5d88c LRU sort recent projects and disambiguate display names 2014-02-10 16:57:10 +07:00
Allan Odgaard
413c77931a When restoring open tabs, skip non-existing files 2014-02-08 16:28:17 +07:00