80 Commits

Author SHA1 Message Date
Allan Odgaard
423e8e9a43 Allow disabling atomic save via .tm_properties
This is done by setting `atomicSave` to one of the following values:

    always           Always use atomic saving (default)
    externalVolumes  Use for non-internal volumes (e.g. USB drives)
    remoteVolumes    Use for non-local volumes (e.g. network mounts)
    never            Never use atomic saving
    legacy           Always enabled, but do not use NSFileManager

Setting it to `externalVolumes` also includes `remoteVolumes`.
2019-07-07 20:52:50 +02:00
Ian Gregory
2a68a2be53 Add excludeSCMDeleted to hide deleted files
New setting that prevents deleted files from appearing in the file browser while still uncommitted. There seems to be some demand for this (https://stackoverflow.com/questions/17590302/textmate-2-alpha-showing-references-for-deleted-files , https://stackoverflow.com/questions/50428259/how-can-i-keep-deleted-files-from-showing-up-in-textmate-2-file-browser-sidebar), and it's just a nice option to have.
2018-08-06 21:20:06 +02:00
Jake Kirshner
d380e7ab0c Added ability to customize document’s title shown in tabs
To change the title, set `tabTitle` in `.tm_properties` to something other than `$TM_DISPLAYNAME`.
2017-03-10 12:22:28 +07:00
Allan Odgaard
ee2aee21fa Use oak::has_prefix when comparing std::string against string literal 2016-10-17 11:03:41 +02:00
mathbunnyru
0b034f9a9d Use std::string’s compare to avoid searching beyond the prefix length 2016-10-17 10:50:18 +02:00
Allan Odgaard
66410365d1 Remove volume::settings API 2016-10-11 10:36:49 +02:00
Allan Odgaard
7be3703404 Change user defaults to .tm_properties for disabling extended attributes 2016-10-11 10:36:49 +02:00
Allan Odgaard
7f3055e89d Don’t let scoped global settings eclipse scoped default settings
We can have a default setting to ‘source.ruby’ and a global setting of ‘source’, previously the latter would eclipse the former.
2016-10-07 10:02:58 +02:00
Allan Odgaard
fbd5455698 fixup! Don’t let untargeted global settings eclipse targeted default settings 2016-10-02 10:23:26 +02:00
Allan Odgaard
22d16a3b76 Don’t let untargeted global settings eclipse targeted default settings
For example we have targeted defaults to set tab settings for Ruby, Python, and Makefiles. If the user changed the tab size, it would result in a global untargeted setting that would then eclipse the targeted settings because these were “less local”.

This was not an issue prior to 431bba9a2e.
2016-10-01 09:03:26 +02:00
Allan Odgaard
553e89ceb6 Update include statements and link declarations 2016-09-11 12:47:39 +02:00
Allan Odgaard
d11874b4c3 Order sections in Global.tmProperties
We can have multiple file patterns match the path for which we ask for settings, so the order of sections does matter, as we’ll use the setting from the last section with a match.

The order enforced is based on length though with a leading asterisk subtracted from the length, that way ‘*.txt’ will be placed before ‘CMakeLists.txt’ and ‘*.rb’ will go before ‘*_spec.rb’.

Incase of same length, we use regular string compare which would normally put the wildcard match first, e.g. ‘*.config’ goes before ‘.config’.
2016-09-04 20:17:42 +02:00
Allan Odgaard
3046ccd50d Add slash to folder when searching settings for untitled documents
That way, if we have a setting for [ templates/** ] and create a new file in the templates folder (via the file browser) these settings will apply.

Previously we used the folder without trailing slash which required making the file pattern something like [ templates{/**,} ].
2016-07-14 12:21:28 +02:00
Ronald Wampler
e50dc57db0 Manually release GCD objects in C++ libraries
Since these are pure C++ libraries, they are not managed by ARC. This commit partially reverts 469fd74a7b.
2016-07-14 12:21:28 +02:00
Allan Odgaard
431bba9a2e Change precedence of targeted settings
Settings are now ranked by locality first, and only if multiple settings from the same .tm_properties file apply, we rank them further using the following order (from lowest to highest): untargeted, scoped (ranked by scope selector), and finally file pattern match (glob).
2016-07-06 18:59:02 +02:00
Allan Odgaard
469fd74a7b Rely on ARC to manage GCD types (10.8) 2016-06-22 20:43:28 +02:00
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