klembot / twinejs

Twine, a tool for telling interactive, nonlinear stories
https://twinery.org
GNU General Public License v3.0
1.96k stars 293 forks source link

Not always "Find and Replace" finds all words #1203

Open Zuroencantador opened 2 years ago

Zuroencantador commented 2 years ago

Describe the bug.

Not always "Find and Replace" finds all words.

Steps to reproduce:

Go to Story -> Find and Replace -> Look for a word that appears often in your game -> Will not be found all

Expected behavior:

Finds all words.

Additional context on this problem.

No response

Twine version number

i.e.2.4.1

Does this problem occur with the web version of Twine or the desktop app?

Web

What operating system does this problem occur on?

Windows

If this problem is occurring with the web version of Twine, what browser does it occur on?

Chrome/Chromium

Presubmission checklist

klembot commented 2 years ago

Could you please provide a specific example? e.g. can we reduce this down to a single passage and search/replace?

sternfuchs commented 1 year ago

I have the same issue.

Twine version number: 2.5.1 Version: Desktop App OS: Windows 10

Some passages with the text are highlighted, but not all.

Specifics:

-Story size: 300 passages, 35000 words.

Conclusion In the code there seem to be two values: 1) List of highlighted passages 2) List of actually found occurrences List 1) is used in the lower-right-corner message in the Search/Replace dialog List 2) is used, when actually replacing text.

For some reason List 1 is not identical with, or not a clean copy of, List 2.

sternfuchs commented 1 year ago

To me the severity of this bug is very high. A search functionality that does not reliably find all occurrences, is unusable for larger stories.

Debugging in Twine is limited anyway. With this limitation, writing correct code is more or less impossible. I could search in the exported HTML file, but that costs much time because of the extra exporting step and the difficulty to find the corresponding passage.

I also miss the text-list of affected passages. In large stories it is often not possible to see all highlighted passages on one screen. (Edit: I see, there is already an issue for this.)

sternfuchs commented 1 year ago

Could you please provide a specific example? e.g. can we reduce this down to a single passage and search/replace?

As I stated in my above report, it is not related to passage content, because from two passages with identical content it happens, one is highlighted, and the other one not.

klembot commented 1 year ago

@sternfuchs if you're able to attach either of the stories you talk about as examples, that would help me resolve the issue.

sternfuchs commented 1 year ago

@klembot I tried to reduce the story as much as I could. Find the example attached. You have to re-rename it to .html (It comes from the {user}/Documents/Twine/Stories folder, not from export.)

Twine 2.5.1, Windows 10.

Find Replace Test.txt

Steps to Reproduce Part 1 (Highlighting)

  1. Open Story "Find Replace Test"
  2. Choose "Stories"
  3. Choose "Find and Replace" (or whatever it is called in English UI)
  4. Enter "{=" (without the quotes) into the Find field.
  5. The complete lower row should be highlighted while the upper row should not.

Reproduce Part Two (Replacement)

  1. Enter "{=+" (without quotes) into the Replace field.
  2. The replacement should happen in all 7 real occurrences, but the highlighting is still not complete.

Remarks:

Let me know, if this was helpful. Otherwise I try to adapt the example.