Skip to content

feat: support multiline patterns in switch rule conditions#288

Open
rz467fzs7d wants to merge 1 commit intozero-peak:masterfrom
rz467fzs7d:feature/multiline-pattern-editor
Open

feat: support multiline patterns in switch rule conditions#288
rz467fzs7d wants to merge 1 commit intozero-peak:masterfrom
rz467fzs7d:feature/multiline-pattern-editor

Conversation

@rz467fzs7d
Copy link

Summary

Allow users to enter multiple patterns in a single switch rule condition, separated by newlines (in addition to the existing pipe | separator).

Changes

omega-pac/src/conditions.coffee

  • HostWildcardCondition, UrlWildcardCondition, HostRegexCondition, UrlRegexCondition now split patterns by both | and newline \n

omega-web/src/partials/profile_switch.jade

  • Replace single-line input with an expandable textarea (1 row collapsed, 10 rows expanded)
  • Toggle button to expand/collapse
  • Single-line mode blocks Enter key; auto-expands on click when multiline content exists

omega-web/src/omega/controllers/switch_profile.coffee

  • Add isMultiline() helper
  • validateCondition validates each line independently for regex types

Notes

The pre-existing SOCKS5 test failure (should return special compatible result for SOCKS5) exists on master and is unrelated to this change.

@rz467fzs7d
Copy link
Author

  • HostWildcardCondition, UrlWildcardCondition, HostRegexCondition, UrlRegexCondition now accept newline-separated patterns in addition to pipe-separated ones
  • Replace pattern input with expandable textarea (1 row collapsed, 10 rows expanded) with toggle button
  • Single-line mode blocks Enter key and auto-expands on click when multiline content exists
  • validateCondition validates each line independently for regex types

What does this PR do?

  • Improvement

(Note: Translations and typo fixes should be done on https://hosted.weblate.org/projects/switchyomega/ instead of PR.)

Please explain the changes in details here...
HostWildcardCondition, UrlWildcardCondition, HostRegexCondition, UrlRegexCondition now accept newline-separated patterns in addition to pipe-separated ones

Compatibility

Is this PR compatible with old versions? Can users simply upgrade the extension?
Yes

Please describe any possible breaking changes (or surprising UX differences).

Screenshots (if applicable)

20260305170511


After creating the PR:

  • Please make sure the CircleCI test passes. Feel free to add more commits for
    bug or style fixes.
  • Any merge conflicts should be fixed on your side. Prefer rebasing to merging.
  • Allow some time for project maintainers to review and merge the change.
  • New features & behavior changes are subject to discussion. Please understand
    that project maintainers may reject new features, or request changes.

- HostWildcardCondition, UrlWildcardCondition, HostRegexCondition,
  UrlRegexCondition now accept newline-separated patterns in addition
  to pipe-separated ones
- Replace pattern input with expandable textarea (1 row collapsed,
  10 rows expanded) with toggle button
- Single-line mode blocks Enter key and auto-expands on click when
  multiline content exists
- validateCondition validates each line independently for regex types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rz467fzs7d rz467fzs7d force-pushed the feature/multiline-pattern-editor branch from f0267d4 to 6111824 Compare March 5, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant