Allan Odgaard
079377ed49
Require macOS 10.12 and remove compatibility checks
2019-10-07 21:28:16 +02:00
Allan Odgaard
ba43f2ec5e
The $1-n variables in nested replacements weren’t cleared properly
...
When searching for a regular expression with captures, we have $1-n available in the replacement (format) string.
If this format string does further replacements with optional captures (e.g. /^(_)?foo/) then $1 would be inherited from the parent match, when the optional capture did not match anything.
This bug was introduced in 0b1496011f .
2019-07-06 19:35:51 +02:00
Allan Odgaard
7614d44974
Do not check if dirname_r and basename_r are available (10.12)
...
This code is only compiled when deployment target is 10.12+ so the symbols should always be there.
2018-06-07 15:48:58 +02:00
Allan Odgaard
1ac3b47b52
Format string: Include seconds when the period is less than 10 minutes
2018-06-07 15:48:58 +02:00
Allan Odgaard
b828d5bfa9
Only use dirname_r and basename_r if on macOS 10.12
...
Not only do we test for the presence of these functions at runtime, but we do not use them at all, when building with the 10.11 SDK (or earlier).
This is because if we had to support building with an earlier SDK it is not enough to declare the prototypes, we also need to add the symbols as weak to the linker options.
Not using the functions does not remove crucial functionality.
2018-03-08 16:05:52 +07:00
Allan Odgaard
239d5bc19f
Add format string API that accepts lambda (callback) for variables
2017-10-02 20:53:05 +02:00
Allan Odgaard
f869f09b6c
Remove obsolete friend declaration
2017-10-02 20:53:04 +02:00
Allan Odgaard
0b1496011f
Use a lambda for format string variables
2017-10-02 20:53:04 +02:00
Allan Odgaard
47ccee4f36
Do not pass variables to run_command callback
...
The caller already has a copy of the environment variables so this was redundant.
2017-10-02 20:53:04 +02:00
Allan Odgaard
78e0546a59
Return variable value instead of iterator
2017-10-02 20:53:04 +02:00
Allan Odgaard
bc3e42330b
Use nested visitor instead of swapping member variables
2017-10-02 20:53:04 +02:00
Allan Odgaard
107a56e12d
Add some new format string transformations
...
- number: Show number with thousand separators, e.g. “32,351”
- relative: Show dates as relative to now, e.g. “3 minutes ago”
- duration: Show numbers as duration in seconds, e.g. “1 hour, 7 minutes”.
- dirname: Show all but last path component
- basename: Show last path component
- urlescape: Encode characters that are not valid to include in URLs
- shellescape: Wrap problematic strings in single quotes and/or escape single quote characters
2017-10-02 20:53:04 +02:00
mathbunnyru
440414f96c
Use nullptr in all C++ files instead of NULL
...
This brings us a bit of extra type safety, for example where an integer is expected, nullptr should be disallowed by the compiler (unlike NULL).
2016-10-22 21:40:14 +07:00
mathbunnyru
284b5a3896
Slight perfomance improvements
2016-10-18 23:06:48 +02:00
Allan Odgaard
dde19a2725
Explicit constructor required after updating boost
2016-10-12 10:43:42 +02:00
Allan Odgaard
eca58ef2e0
Cache regular expressions used to capitalize strings
...
This was actually a noticeable bottleneck when preparing (key binding) items in the bundle item chooser.
2016-09-30 13:23:42 +02:00
Allan Odgaard
b5d897315c
Add ${«var»:/titlecase} as alias for ${«var»:/capitalize}
2016-09-25 13:08:21 +02:00
Allan Odgaard
1abd03a1a4
Skip parsing format strings w/o special characters
2016-09-18 10:27:56 +02:00
Allan Odgaard
30e04eb72a
Add glob_list_t::add_glob which can be used both for include and exclude
2016-09-14 08:35:24 +02:00
Allan Odgaard
28b9fadb63
Let “exclude” be part of the item type in glob_list_t
2016-09-14 08:34:02 +02:00
Allan Odgaard
e381dbaf58
Fix typo in comment
2016-08-04 14:37:02 +02:00
Allan Odgaard
6a476b868c
Add regexp::escape helper to escape special characters
2016-06-29 14:21:55 +02:00
Allan Odgaard
f60e0dad98
Use text::transcode_t instead if iconv API
2016-06-21 18:33:20 +02:00
Allan Odgaard
8483826fae
Always use '\0' as fill value when creating a string buffer
2016-06-18 10:34:08 +02:00
Allan Odgaard
e83fee564c
Refactor: use emplace_back(…) instead of push_back(make_pair(…))
2016-05-28 22:12:46 +02:00
Allan Odgaard
8fe7681ebd
Remove unnecessary include of oak/compat.h
2015-08-05 12:31:20 +02:00
Allan Odgaard
4827e354f0
Don’t call non-virtual member functions for nullptr
2015-05-09 21:40:29 +02:00
Allan Odgaard
9ceb07e54c
Add API to escape a string for use in a glob pattern
2015-04-30 15:15:57 +02:00
Allan Odgaard
40879d5683
Replace sizeofA macro with range-based for loop or std::begin/end
2015-03-05 16:38:09 +07:00
Allan Odgaard
812f8146bf
Only limit regexp search to 5 MB when operating on disk file
...
That is, if the file has been opened by the user, there is no size limit on what we will search.
2015-01-29 14:37:56 +07:00
Allan Odgaard
0bdefafac3
Remove dependency graph support to only framework using this API
2014-12-25 09:33:56 +01:00
Allan Odgaard
ab69cf8b4a
Make code more robust
...
This is motivated by a crash that indicates that an empty string might result from the `all_varations` function.
2014-11-21 13:24:24 +01:00
Allan Odgaard
a778f0b3da
Combine std::set’s find and insert into a single operation
2014-11-10 17:11:31 +01:00
Allan Odgaard
609558edac
Regexp search a 5+ MB file could find matches in wrong locations
...
The code was supposed to stop the search after 5 MB, this didn’t always work, and when it worked, the returned match offsets were not always correct (as they didn’t account for the capped buffer size).
2014-10-29 12:24:12 +01:00
Allan Odgaard
6f68d2afb1
Titlecase does not preserve case when everything is uppercase
2014-10-03 21:49:13 +02:00
Allan Odgaard
ab83cc6e50
Strip diacritics and combining marks when asciifying
...
Previously we would transliterate æ → ae and å → a (via iconv) but something like é became 'e.
Related to issue textmate/latex.tmbundle#87 .
2014-09-15 11:02:25 +02:00
Allan Odgaard
5d72c8a2c5
Support case-insensitive glob matching
2014-08-24 12:12:24 +02:00
Allan Odgaard
94165739fb
Improve capitalization heuristic
...
See added/updated tests for details.
2014-08-22 14:29:16 +02:00
Allan Odgaard
e81286b0cd
Remove unused include
2014-05-16 22:11:28 +07:00
Allan Odgaard
af3f4aaa33
Check result of most CF/CT ‘Create’ functions
2014-05-15 13:17:30 +07:00
Allan Odgaard
c272afaff2
Cleanup/harmonize whitespace
...
Leading indent should consist only of tabs, beyond that, only spaces should be used.
2014-04-25 16:55:31 +07:00
Allan Odgaard
9e4a5ccd82
Add instance counter for node_t (used by glob parser)
...
This will alert us of any leaks (if instance count is non-zero during quit).
2014-04-19 17:01:31 +07:00
Allan Odgaard
91b216bf24
Use glob parser for brace expansion
2014-04-19 17:01:31 +07:00
Allan Odgaard
d178527924
Do not make expansion order assumptions about consecutive braces
2014-04-19 17:01:31 +07:00
Allan Odgaard
7d1f7941b9
Include exclude operator in glob syntax comment/documentation
2014-04-19 17:01:31 +07:00
Allan Odgaard
78e76f55d8
Improve handling of empty braces in globs
...
We treat empty braces as literal characters though do balance them.
2014-04-18 20:30:07 +07:00
Allan Odgaard
9524439aef
Handle bang in globs (negation) identically to tilde
...
This simplifies the code (slightly) and allows the bang to appear in other positions than leading.
2014-04-18 06:40:48 +07:00
Allan Odgaard
45481d2e4d
Add tilde (~) as a glob “exclude” operator
...
For example the following glob will match C++/Objective-C++ source/header files, except those in the ‘vendor’ directory: *.{cc,mm,h}~vendor/**
It is possible to do multiple exclusions, e.g.: src/**~*.log~*.db
It is also possible to start with the exclude operator to negate the pattern (identical to the ! operator).
The exclude operator is not supported inside brace expansion, e.g.: {*.o,*~.nib} will treat it as a literal tilde. Furthermore, placing the tilde last will also treat it as a literal tilde, e.g.: *.txt~
In the exclude pattern, single/double asterisk (*/**) will match hidden files.
2014-04-18 06:40:48 +07:00
Allan Odgaard
01722b9a6e
Create custom parser for glob patterns
...
Previously we parsed them using regular expressions, but future improvements is hard using that approach.
2014-04-18 06:39:55 +07:00
Allan Odgaard
0b2932b3de
Add test for empty glob (should not match anything)
2014-04-18 06:39:28 +07:00