26 Commits

Author SHA1 Message Date
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
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
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
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
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
0b2932b3de Add test for empty glob (should not match anything) 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
6185cc17ab Do not inherit numbered variables for potential regexp captures
If the format string itself does a replacement with potential captures $1-$n then we ensure that $1-$n are not inherited from the environment (which could be a parent regexp match).
2014-04-05 14:13:39 +07:00
Allan Odgaard
c7ae7d1337 Add test for snippets with overlapping fields
See 4e1cdb4c9e for details.
2014-03-07 00:10:35 +07:00
Allan Odgaard
e1230653f8 Support hex characters in format strings 2013-08-27 15:30:09 +02:00
Allan Odgaard
36c5ff4288 Support ${var} in regexp part of format string transformations 2013-08-24 20:28:16 +02:00
Allan Odgaard
1467a0b44b Update testing system for regexp framework 2013-07-26 13:53:58 +02:00
Allan Odgaard
d16f3bcc1e Use per-line indent patterns when estimating indent
This solves the problem where we need to estimate the current line’s indent, but the lines above it is a multi-line block comment. Previously we would fetch indent patterns based on the current scope, then find the first line above caret, for which the patterns can be used to estimate the indent. The problem is that the commented lines without comment markers would be treated as code, and used for the indent.

With the new approach, we can set different patterns for ‘comment.block’ (the C bundle already does this), which basically ignore all the lines, which will cause TextMate to use the code above the comment to estimate indent.

This commit closes textmate/c.tmbundle#3 and also closes textmate/php.tmbundle#24.
2013-03-13 12:38:12 +01:00
Allan Odgaard
8b8e02d6da Add minimal tests for regex::search 2013-02-08 11:20:35 +01:00
Allan Odgaard
10b794bb96 Creating empty glob_list_t matches everything
This is more than creating a glob_list_t containing just ‘*’, as the latter does not match hidden files, so it is more like ‘{*,.*}’, which is a bit arcane, so I think it’s better to allow using an empty list in cases where you wish to match everything (but the API accepts a glob list for filtering purposes).
2013-01-16 04:42:51 +01:00
Allan Odgaard
0f3861fec7 Retire custom begin/endof functions
We can now use std::begin/end although for containers we explicitly call the member functions.
2012-09-20 12:22:21 +02:00
Allan Odgaard
ec4ac60ae4 Add glob test: ‘*.ext’ doesn’t match ‘.ext’
I wasn’t sure if this was really desired, but it mimics bash.
2012-09-16 11:41:23 +02:00
Allan Odgaard
015d6a2a23 Add glob_list_t type
This can be used to manage a list of accept/reject globs.
2012-09-12 18:30:36 +02:00
Allan Odgaard
e8837fcf9f Improve glob matching
1. The * and ** operators will now match a dot if not at the beginning of a path component. E.g. ‘main*’ will match ‘main.cc’.
2. When negating a glob, the * and ** operators will include dot files. E.g. ‘!cache/**’ will match (reject) ‘cache/.DS_Store’.
3. The ** operator no longer needs a trailing slash. E.g. ‘src/**.cc’ will match ‘src/main.cc’ and ‘src/sys/util.cc’.
2012-09-12 18:30:35 +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
13026c70ca Add format_string::escape
This produces a string where all format string characters have been properly escaped.
2012-08-25 00:57:48 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00