atom / find-and-replace

Find and replace in a single buffer and in the project
MIT License
242 stars 219 forks source link

Find and replace all momentarily reports incorrect number of results found #1124

Open finnbear opened 4 years ago

finnbear commented 4 years ago

Prerequisites

Description

After using the find and replace all option, the number of results found is reset to 0. This is sometimes appropriate but not always.

Steps to Reproduce

1.In any file, type a string like "abcdabcd"

  1. Find and replace "abcd" with "abcdabcdabcd" (atom shows 2 results found before clicking replace)
  2. Watch the number of results found right after clicking the find and replace button

Expected behavior:

Text in the file is now: abcdabcdabcdabcdabcdabcd Number of results found is: 6

Actual behavior:

Text in the file is now: abcdabcdabcdabcdabcdabcd Number of results found is: 0 Number of results found after a second or two: 6

Proposed solution:

Instead of setting the number of results found to 0, multiply the previous number of results found by the number of times the string to find appears in the string to replace.

Reproduces how often:

100%

Versions

1.46.0 Ubuntu 19.04