Multiline regular expression search toggle (regex multi-line support)
Summary
Add explicit support for using multi-line regexes.
Description
Zed currently only supports multiline regex implicitly if there is a \n included in the needle:
https://github.com/zed-industries/zed/blob/8cf7206adf2fd902cff39d4ea3391a5764d7892c/crates/project/src/search.rs#L140
But there are regular expressions without an explicit \n that behave differently between multiline mode and single line mode. \s+$ is one such example:
- https://github.com/zed-industries/zed/issues/25901#issuecomment-2692996651
There are a number of design considerations:
- Is the icon present when not in regex mode?
- Does Zed preserve the existing intuitive behavior that when your needle includes
\ndo we automatically enable multiline? - Do we automatically enable for
\swhich includes\n? - Icon for multiline toggle
Given that few people understand the subtle implications of multiline vs non-multiline regexes, it may be a disabled button most of the time (when not in regex mode) and that VSCode, JetBrains and Sublime do not include explicit multi-line regex toggles, it might be reasonable to make this require an opt-in setting like "features": { "regex_multiline" } to avoid more confusing buttons to the existing set:
References:
- https://docs.rs/regex/latest/regex/#perl-character-classes-unicode-friendly
- https://www.unicode.org/reports/tr18/#Compatibility_Properties
- https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt