64 Commits

Author SHA1 Message Date
Allan Odgaard
55b2f6366e Remove ‘useBOM’ settings key 2016-06-21 19:31:22 +02:00
Allan Odgaard
417193e089 Update link dependencies for all targets
Some targets were including headers from frameworks not specified in their link dependencies. For a clean build this could cause an issue because the header was not available at the time of building the target.

The updated link dependencies are also based on what a target’s tests require. Ideally tests would have separate link dependencies, but as we don’t want to maintain this manually, this will have to wait until the build system automatically handles link dependencies.

Currently the commit command uses constants from the CommitWindow framework but should actually not be linked with it. However, the optimizer will strip dead code, so it should not result in much if any difference in the resulting binary and does solve a build dependency issue.
2016-05-07 13:00:55 +02:00
Josh Bernitt
263da53c81 Optionally draw a horizontal line for every tab stop
This can be toggled using View → Show/Hide Indent Guides or controlled per file type via the `showIndentGuides` setting in `.tm_properties`.
2016-05-02 19:58:01 +02:00
Adam Strzelecki
83653f7b89 Settings: Empty string should be serialized as ''
Otherwise we get syntax error reading back the value from Global.tmProperties.
2016-01-29 08:46:18 +07:00
Allan Odgaard
8fe7681ebd Remove unnecessary include of oak/compat.h 2015-08-05 12:31:20 +02:00
Allan Odgaard
883fd2b6f8 Add variables from Preferences → Variables to bundle item chooser 2014-11-10 20:51:17 +01:00
Allan Odgaard
99cd82abee Include value and line number when asking for settings info
The section name is now also the literal section name rather than to_s called on the parsed scope selector or glob (which wouldn’t necessarily give the source value).
2014-11-10 09:11:48 +01:00
Allan Odgaard
366ab820ca Store doubles without decimals as integers (Global.tmProperties)
This mainly relates to fontSize which we store as a double since the font panel allows setting non-integer values as the point size.
2014-11-10 09:11:12 +01:00
Allan Odgaard
89400822d3 Add settings_info_for_path to get path/section for .tm_properties 2014-09-07 10:31:16 +02:00
Allan Odgaard
57da86ba5c Use higher order function to collect settings 2014-09-07 10:31:16 +02:00
Allan Odgaard
06484ae92a Remember which path a property section is extracted from 2014-09-07 10:31:16 +02:00
Allan Odgaard
de3f867c9e Use std::mutex and std::lock_guard instead of pthread_mutex_t
Also move the mutex out so that other functions can lock it.
2014-09-07 10:31:16 +02: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
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +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
0a21664f6d Replace iterate macro with new for loop (C++11)
Also use emplace_back a few places.
2013-12-14 13:12:45 +07:00
Allan Odgaard
45db36234c File path settings now rank higher than scope settings
A file setting like “src/*.cc” is arguably more specific (and thus more local) than targeting the scope “source.c++”, so it makes sense that the file settings rank higher than scope settings.

Some users also find it natural to target file extensions over scopes, but as TM will store some learned settings with a scope selector, it would previously lead to confusion, when a user was unable to e.g. change tab size for “*.php” (because TM had a learned setting for “source.php”).
2013-12-14 12:57:24 +07:00
Steven Clukey
bbe1ca357b Add “invisiblesMap” option to the .tm_properties file
This setting allows changing which invisibles are shown and what glyph
is used for them.

Invisibles are '\t', '\n', and ' ', to turn one off, add ~[\t \n] to
the settings string. To set the glyph used for the invisible, add [\t
\n][glyph_to_use].
2013-10-08 23:06:29 +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
fc7f86d8eb Do not clear cache during normal lookup
We keep indirect references to cache lookups (for the duration of the function that use the cache) so we can only do cleanup at the start or end of the function which use the cache.
2013-08-28 15:27:42 +02:00
Allan Odgaard
ba85697ac4 Change “counterpart” to “related file”
This applies both to the action method and the settings key, the latter is now relatedFilePath to indicate that it’s a full absolute path (neither relative or a glob pattern).
2013-07-21 13:25:27 +02:00
Allan Odgaard
698f08ab35 Allow customizing what is used for ‘Go to File Counterpart’ (⌥⌘↑)
The user can now set ‘counterpart’ in .tm_properties to the absolute path of what should be used for ⌥⌘↑. If the file does not exist (on disk or as an open tab) then TextMate will fallback to searching the current folder for a file with same name.

To switch between go source and go test files one could add the following:

   [ *.go ]
   counterpart = "${TM_FILEPATH/(_test)?\.go$/${1:?:_test}.go/}"

Here the regular expression transformation will remove ‘_test’ from the file name if it exists, otherwise add it.

One could also do multiple settings like:

   [ *.go ]
   counterpart = "${TM_FILEPATH/(?=\.go$)/_test/}"

   [ *_test.go ]
   counterpart = "${TM_FILEPATH/_test(?=\.go$)//}"

Here ‘*.go’ files get the ‘_test’ added to their name, though files matched by the ‘*_test.go’ glob will instead have it removed.
2013-07-11 00:23:25 +02:00
Allan Odgaard
f5d28f2dd1 Let file chooser read ‘followSymbolicLinks’ from .tm_properties
Set this to ‘true’ if you want the file chooser (⌘T) to follow symbolic links.

The reason for making it a ‘.tm_properties’ setting is only because I am not yet sure how to best integrate this into the UI. The find dialog has an identical UI option which is global option — it would make sense to coalesce these two options, and while doing that, make the find dialog’s version a project/path setting rather than have it be global.

Closes #984.
2013-06-25 17:43:45 +02:00
Allan Odgaard
35ffdd5dd8 Don’t setup basic environment in ‘variables_for_path’
We expect the caller to pass us a properly setup environment.
2013-05-12 11:09:18 +07:00
Allan Odgaard
bf7d657eef Move some TM variables to oak::basic_environment 2013-05-12 11:09:18 +07:00
Allan Odgaard
ec9208afa9 Use whitelist feature to preserve dialog variables 2013-05-12 11:09:18 +07:00
Allan Odgaard
ce4ae62547 Change ‘variables_for_path’ API
We now accept the a directory in addition to the path. If a directory is provided, the path is only used to filter variables rooted at the directory.
2013-05-12 11:09:18 +07:00
Allan Odgaard
bd34c84253 Remove support for disabling file browser status updating
This preference was introduced as a workaround for poor performance when displaying large folders, this however should no longer be an issue.
2013-03-19 15:02:32 +01:00
Allan Odgaard
57c2aeda47 Use libdispatch for monitoring file changes
This is instead of using kqueue, which has more overhead and require a dedicated thread for the kevent run-loop.
2013-02-25 15:28:37 +01:00
Allan Odgaard
a3ec258912 Update settings tests to new system 2013-02-25 15:25:17 +01:00
Allan Odgaard
b718106ff8 Make semi-internal API private
This was previously public so that we could write tests for it, but since the test runner is linked with the object files, it can access symbols that has visibility set to hidden.
2013-02-23 11:24:56 +01:00
Allan Odgaard
873b9e8ced Introduce TM_PROPERTIES_PATH
This will be a colon-separated list of the .tm_properties files sourced for the current context. Mainly for debug purposes but could be used for an “Edit Properties…” command that show existing files (without having to scan the disk).
2013-02-15 15:27:56 +01:00
Allan Odgaard
9637ca051f Only set CWD for root section
The bracketed sections inherit from the root section, so there is no need to set this variable for each.
2013-02-15 15:27:56 +01:00
Allan Odgaard
b139ac5097 Change push_back → emplace_back (C++11)
This is mainly motivated by readability, so I only did a few select replacements.
2013-02-08 11:20:35 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
6cd18bafb0 Allow property sections to match folders
We generally lookup include/exclude patterns for a folder rather than a file, and here it makes sense to allow the bracketed sections of the property files to target the folder.

Since the sections are not ranked based on how good a match they are, targeting a subfolder, and then a subfolder of this subfolder, does not have which settings take precedence defined.
2013-01-28 21:01:12 +01:00
Allan Odgaard
54fe77ebdb Fix coding style 2013-01-28 20:37:33 +01:00
Allan Odgaard
f8fa69d8b4 Calling setting_t::set with NULL_STR restores the default 2013-01-25 11:01:56 +01:00
Allan Odgaard
fae30ed6e8 Use wrapper for getpwuid() to avoid crash
Based on crash logs this problem still exists on 10.8.2 <rdar://10261043>.
2013-01-10 23:48:46 +01:00
Josh Goebel
dc34d5c9d9 Allow disabling document status in file browser
Disabling this is achieved by setting `fileBrowserDocumentStatus` to `false` in `.tm_properties`.

Disabling it should remove potential delays after opening, closing, and saving files when file browser is showing a lot of files. It is meant as a temporary workaround until the performance issues are addressed.
2012-11-12 13:28:34 +07:00
Ole Gammelgaard Poulsen
ca25560f19 Added tm_query CLI that returns settings and variables for a file 2012-09-24 21:32:29 +02:00
Allan Odgaard
a45c2f6ea9 Improve “is scope selector” heuristic
A root scope can also be followed by a comma, e.g. “text, source”.
2012-09-16 18:00:35 +02:00
Allan Odgaard
923dab6375 Scoped properties are now applied last
This is so that a global setting for ‘source.ruby’ takes precedence over a local ‘source’ setting.

A minor downside is that a local properties file cannot use scoped settings outside a scope selector section.
2012-09-16 11:41:24 +02:00
Allan Odgaard
ba28b9e1ae Set TM_APP_IDENTIFIER
This is for bundles that need to read TextMate’s preferences file (should only be those using a nib with user defaults bindings for their preferences dialog).
2012-09-12 18:30:37 +02:00
Allan Odgaard
4f017345fc Add file/folder exclude keys for search and file chooser
This is just for completeness.
2012-09-12 18:30:36 +02:00
Allan Odgaard
b2fa6ff377 Remove UUID from settings API
Don’t recall what the intent was with this.
2012-09-11 00:05:05 +02:00
Allan Odgaard
c332ae69e6 Allow disabling SCM status from .tm_properties
This is done by adding the following (which can be limited to a folder):

    scmStatus = false
2012-09-02 17:53:50 +02:00
Jacob Bandes-Storch
d4ce498f60 Use 64-bit: numeric type fixes
Unfortunately a printf precision specifier (‘%.*s’) can not come with a width specifier so we have to cast to int. The width specifier ‘t’ is used for ptrdiff_t.
The int → NSInteger change fixed a bug with popup menu positioning, but there was no associated warning or error. It's possible there are more such bugs that we haven't found yet!
2012-08-28 21:32:47 +02:00
Allan Odgaard
15ba1374ca Add settings_t saving tests 2012-08-26 01:26:16 +02:00