the issue of pattern find

Summary

There are multiple issues in Mousepad's Find function.

  1. In some cases, the search function reports "not found" even though the searched text is present in the file.
  2. This appears at least in some JSON files.
  3. Search behavior becomes inconsistent after Regular Expression mode is enabled and then normal text search is used again.
  4. In long files, Mousepad may freeze or lock during search.

At this stage, I do not yet know every exact word or word group that triggers the issue. I have encountered it multiple times, and I can provide specific examples later.


Environment

  • Application: Mousepad
  • Version: [0.7.0]
  • OS / Distribution: [Debian]
  • Desktop environment: [Gnome & Xfce & Kde]
  • File type: JSON, and possibly other text files

Issue 1: false "was not found (no found pattern)" result in JSON files

Description

In at least some JSON files, when I search for a specific word group that I know is present in the file, Mousepad reports that it cannot find it.

Expected behavior

If the searched word group exists in the file, Find should locate it and jump to the correct line.

Actual behavior

Mousepad sometimes shows a "not found" result even though the text is present.

Notes

I do not yet know whether this affects every file or only some files.
So far, I have observed it in JSON content.


Issue 2: inconsistent behavior after regex toggle

Description

When I search for a word group in normal mode, Mousepad may fail to find it.
If I enable Regular Expression, it may then find the text.
After that, if I change the query on purpose and then write the original correct text again, Mousepad may fail to find it once more.

However, when I bring the lines containing that text onto the screen, the Find UI may then show the correct text.
This behavior appears as a repeatable bug.

Expected behavior

  • Literal text search should behave consistently.
  • Toggling Regular Expression on/off should not corrupt or preserve stale search state.
  • The same valid query in the same file should return the same result every time.

Actual behavior

  • Normal search may fail.
  • Regex mode may find the same text.
  • After query changes, the original valid text may fail again.
  • When the relevant lines become visible on screen, the UI may appear to recognize the correct text.

Issue 3: freeze / lock in long files

Description

In long files, Mousepad may freeze or lock during search.

Expected behavior

Search should remain responsive even in large files.

Actual behavior

Long files may cause severe slowdown, freeze, or lockup.


Technical notes / possible cause

This does not look like a simple user-side search mistake.
It looks more like one of the following internal issues:

  • mismatch between rendered text and internal search buffer
  • stale search state after regex toggle
  • incomplete reset of cached match positions or highlight state
  • incorrect handling of escaped characters / invisible characters in JSON
  • performance issue in large-file search path
  • heavy search work on the UI thread

The behavior where the correct text becomes visible once the relevant lines are on screen suggests there may also be a sync issue between the search logic and the rendered viewport.


Reproduction

At the moment I do not yet have a minimal reproducible file or exact trigger phrase for every case.
I will provide specific examples later.

Current rough reproduction pattern:

  1. Open a JSON file.
  2. Search for a phrase that is known to exist in the file.
  3. Mousepad may report "not found".
  4. Enable Regular Expression.
  5. Search again; Mousepad may now find the text.
  6. Change the query deliberately.
  7. Re-enter the original correct text.
  8. Mousepad may fail again.
  9. Scroll or bring the relevant lines onto the screen.
  10. The Find UI may then appear to reflect the correct text.

Additional information

I can provide:

  • exact search phrases
  • example JSON content
  • video capture
  • version details

once I collect a fully minimal example.

Edited by Said Ali