Skip to content

Fix zero-width regex replace#815

Merged
lhecker merged 4 commits intomicrosoft:mainfrom
MihneaTeodorStoica:fix-zero-width-replace-all
Apr 27, 2026
Merged

Fix zero-width regex replace#815
lhecker merged 4 commits intomicrosoft:mainfrom
MihneaTeodorStoica:fix-zero-width-replace-all

Conversation

@MihneaTeodorStoica
Copy link
Copy Markdown
Contributor

@MihneaTeodorStoica MihneaTeodorStoica commented Apr 24, 2026

As a drive-by this also puts all replace-all
changes into a single undo group.

Tested by:

  • Running Replace-All with $ and "x": Every line gets a trailing "x",
    the final line gets a lone "x" and a new trailing newline is added.
  • Running Replace with $ and "x" repeatedly: New "x"s are added to
    each line incrementally, and it wraps around the buffer.

Closes #775

@lhecker
Copy link
Copy Markdown
Member

lhecker commented Apr 27, 2026

I do not like that you submitted this PR without testing it in practice first. That's not per the OSS decorum.
I'm working on a proper fix based on your PR.

@lhecker lhecker changed the title Fix zero-width regex replace all (#775) Fix zero-width regex replace Apr 27, 2026
@lhecker lhecker force-pushed the fix-zero-width-replace-all branch from 917ee6a to 422244a Compare April 27, 2026 18:25
Comment thread crates/edit/src/icu.rs
}

static mut LIBRARY_FUNCTIONS: LibraryFunctionsState = LibraryFunctionsState::Uninitialized;
static LIBRARY_FUNCTIONS: OnceLock<Option<LibraryFunctions>> = OnceLock::new();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we have concurrent unit tests that rely on ICU, OnceLock is needed.

@lhecker lhecker requested a review from DHowett April 27, 2026 18:26
@lhecker lhecker enabled auto-merge (squash) April 27, 2026 21:16
@lhecker lhecker merged commit d14e24b into microsoft:main Apr 27, 2026
3 checks passed
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.

Can't replace zero width regex matches with text

3 participants