Skip to content

Fix Find & Replace with empty replacements#457

Merged
lhecker merged 1 commit intomainfrom
dev/lhecker/439-replace-empty
Jun 10, 2025
Merged

Fix Find & Replace with empty replacements#457
lhecker merged 1 commit intomainfrom
dev/lhecker/439-replace-empty

Conversation

@lhecker
Copy link
Member

@lhecker lhecker commented Jun 10, 2025

Closes #439

@Shivix
Copy link
Contributor

Shivix commented Jun 10, 2025

One thing I noticed with this approach is that some of the callers of this function check if it's empty before calling it anyway. So most of the behaviour is the same outside of the find & replace use case.
The exception to that is the following:

tb.write(ctx.clipboard(), true);

Edit:
On further testing, this changes the behaviour here, we now will delete any selection if we press the paste menu button with an empty clipboard.

@lhecker
Copy link
Member Author

lhecker commented Jun 10, 2025

Oh, thanks for noticing this.

@lhecker
Copy link
Member Author

lhecker commented Jun 10, 2025

On second thought, coincidentally we don't need to fix this, because I already rewrote clipboard handling where it checks for empty clipboard contents: #405

@lhecker lhecker merged commit e693aa5 into main Jun 10, 2025
3 checks passed
@lhecker lhecker deleted the dev/lhecker/439-replace-empty branch June 10, 2025 17:33
Lou32Verbose pushed a commit to Lou32Verbose/edit that referenced this pull request Jan 11, 2026
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.

Unable to replace if replacement is an empty string

3 participants