Commit Graph

291 Commits

Author SHA1 Message Date
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
Allan Odgaard
091e554a1b Remember open files per (project) folder
This means that if one does “mate «folder»”, open a few files as tabs, and then close the window, next time the same folder is opened, TextMate will restore the tabs.

Presently state is remembered (when closing a window) either if the file browser is visible or if more than one document is open in the window.
2014-02-07 19:53:28 +07:00
Allan Odgaard
106ad9623c Factor out “session restore” (for a single document controller) 2014-02-06 22:47:35 +07:00
Allan Odgaard
fa0a82ca4a Factor out “session info” (for a single document controller) 2014-02-06 20:35:12 +07:00
Allan Odgaard
4d718b6207 Auto-reveal open file now works with hidden file browser
When the file browser is hidden we no longer auto-reveal. When the user shows the file browser, we select the currently open document.
2014-02-05 12:27:53 +07:00
Allan Odgaard
7ced73244f Add setting to disable tab re-ordering
When opening a document it will be placed to the right of the current one (in the tab bar) even if the document being opened is already in the tab bar, this is to make ⌘W work to “close and go back” without having to keep a list of previously selected tabs.

This feature can now be disabled using:

    defaults write com.macromates.TextMate.preview disableTabReordering -bool YES

Note though that if one selects multiple documents to open then it will potentially re-order the tab bar so that the documents selected are adjacent.
2014-01-29 16:09:20 +07:00
Torsten Trautwein
a88f9baf5f Preference to auto-reveal the current file in the project browser
An option called "Auto-reveal open file in project browser" has been
added to the Projects preference pane. When checked, the currently open
file will be revealed in the project's file browser. By default, the
option is not checked and thus the behavior is as it was before.
2014-01-20 20:15:25 +07:00
Allan Odgaard
5bbbed72e5 Saving file with missing parent asks if it should be created 2013-12-14 14:37:55 +07:00
Allan Odgaard
a5fe5d929d Opening a file with unused project UUID will create a new window
This can be used to force a file to open in a new window, e.g.:

    TM_PROJECT_UUID=$(uuidgen) mate README.md

Likewise, it can be used to force multiple invocations of mate to use the initially opened window (by re-using the UUID).

Closes #879
2013-12-12 16:58:32 +07:00
Allan Odgaard
93e00f42b1 Fix potential missing last line in encoding view
This would happen if last line was not newline terminated.

The fix does not take into consideration that last line might contain non-ASCII, in which case it should be highlighted.
2013-11-03 20:37:48 +01:00
Allan Odgaard
c53b0cf42d Full paths on search clipboard are made relative to file chooser base 2013-11-03 20:37:34 +01:00
Allan Odgaard
323577a013 Use window positioning code from OakChooser 2013-10-27 20:04:48 +01:00
Allan Odgaard
3064fb82b4 Change text::range_t → ng::range_t 2013-10-20 19:10:02 +02:00
Allan Odgaard
0b0d0ef550 Disable wrapping for NSTextView
Unfortunately this doesn’t cause the container to get the proper width, but in most cases this is probably preferred over having the content wrap.
2013-10-19 21:41:03 +02:00
Allan Odgaard
2d1fbc1ff5 Add Go → Go to Tab → Last Tab (⌘0)
Closes #1150
2013-10-18 21:14:07 +02:00
Ryan Goulden
3548028a65 Always recommend plain text when opening files. 2013-10-10 02:39:44 -04:00
Allan Odgaard
0a47054e14 Fix potential exception in encoding selector sheet
Some valid UTF-8 byte sequences are not valid code points, so our “simple” validation is no guarantee that creating an NSString from the data will succeed.
2013-10-08 21:59:55 +02:00
Allan Odgaard
17a861fd37 Fix potential infinite loop in the encoding selector sheet 2013-10-08 21:59:55 +02:00
Allan Odgaard
5b27a39bb8 Fix compatibility with 10.7 2013-10-06 23:09:12 +02:00
Allan Odgaard
1baa953955 Set the encoding window controller as window delegate
No reason for this other than it seems right.
2013-10-06 23:09:11 +02:00
Allan Odgaard
72d6851eb0 Avoid leaking the encoding chooser sheet 2013-10-06 23:09:11 +02:00
Allan Odgaard
5f765ab061 Use encoding::classifier_t when opening files 2013-10-04 17:09:02 +02:00
Allan Odgaard
344fac505b Improve the “unknown encoding” sheet
A preview is now shown with the problematic lines highlighted.
2013-10-04 17:08:12 +02:00
Allan Odgaard
712a18cd50 Add IBAction to methods 2013-09-12 23:46:05 +02:00
Allan Odgaard
1ae67343f1 Add menu validation for close tabs related actions 2013-09-12 23:46:05 +02:00
Allan Odgaard
35ad8a1ed9 Add action method for closing tabs to the right 2013-09-12 23:46:05 +02:00
Allan Odgaard
aa08d67090 Let tab menu methods fallback on active tab
These normally require that the sender is an NSIndexSet or has one as its represented object, but with this commit, they will also be usable when there is no index set available, and will then simply use the active tab.
2013-09-12 23:46:05 +02:00
Allan Odgaard
e4a5db0f3b Only first call to window.close() would have an effect
This is a workaround for https://bugs.webkit.org/show_bug.cgi?id=121232
2013-09-12 23:46:04 +02:00
Allan Odgaard
8c7e68bf2f Ensure that at least 8 tabs stay open when auto-pruning 2013-09-12 23:46:03 +02:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
d58bb1fdde Avoid using NULL_STR with scope_t::push_scope 2013-09-03 12:10:18 +02:00
Allan Odgaard
32f4cedece Bring HTML output window to front on ⌃⌥⌘H when not already key
Previously it would hide if already visible regardless of being the key window or not.
2013-08-21 13:44:17 +02:00
Allan Odgaard
bffe0facff Change cancel button key equivalent: ⌘. → ⎋
The new key will still allow canceling the dialog using ⌘.
2013-08-18 17:29:29 +02:00
Allan Odgaard
a52165694c Move crash reporter info support to own framework
This is to avoid cyclic dependencies since it was previously in a somewhat high-level framework, so everything that framework depended on, could not augment crash reports.
2013-08-12 19:32:23 +02:00
Allan Odgaard
7fa1d96faa Fix crash when “close tabs” is sent to window with no tabs
It appears a window can hang around after its last tab has been closed. Such window receive notifications of items being deleted via the file browser, and will call the “close tabs” method in response to these, which does an out-of-range array access if no tabs exist.

The reason for why windows can hang around after last tab is closed has not yet been determined. It might be a retain cycle (bug) or a delayed release due to autorelease pools.

Fixes #1064
2013-08-10 11:41:40 +02:00
Allan Odgaard
5e5bbc468f Revert "The 10th tab now get ⌘0 as key equivalent"
This commit made the 11th tab get ⌘1 as key equivalent. Fixes #1078.

This reverts commit 5e6cfe8e1e.
2013-08-09 21:56:02 +02:00
Allan Odgaard
afcba9b1e8 Collect info related to a crash 2013-07-31 17:55:24 +02:00
Allan Odgaard
05efb628b4 Setup indent settings at a higher level
We now setup the indent settings when creating untitled documents where we know the folder, so that we can use potential settings scoped to that folder.

Since the document itself no longer sets this as part of regular buffer setup, we also set it when opening a document with a path, and when changing a document’s file type, although the latter is probably temporary.

Closes #305.
2013-07-29 15:50:31 +02:00
Allan Odgaard
6718a8a32c Use libdispatch for threaded write to pipe 2013-07-26 23:09:14 +02:00