Bug 463767 - search & replace unicode char is very slow
Summary: search & replace unicode char is very slow
Status: ASSIGNED
Alias: None
Product: kate
Classification: Applications
Component: search (show other bugs)
Version: 22.08.2
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-03 04:38 UTC by Fahad Al-Saidi
Modified: 2024-11-03 17:10 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
a big file contains hidden unicode chars (1.72 MB, text/plain)
2023-01-03 04:38 UTC, Fahad Al-Saidi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fahad Al-Saidi 2023-01-03 04:38:44 UTC
Created attachment 154982 [details]
a big file contains hidden unicode chars

SUMMARY
***
I have a txt file generated it for tesserocr that has lot of hidden Unicode chars under Pop Directional Formatting (PDF) block. So I want to search & delete them. I notice that kate is very slow in doing that.
***


STEPS TO REPRODUCE
1. download attached txt file.
2.  search & replace (Ctrl+R)
3. type \x{202C}
4. choose Regular expression mode
5. Click Replace all.

OBSERVED RESULT
the process is very slow.

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  KDE neon 5.26 22.04 (x86_64)
(available in About System)
Operating System: KDE neon 5.26
KDE Plasma Version: 5.26.2
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 5.15.0-52-generic (64-bit)

ADDITIONAL INFORMATION
Comment 1 Fahad Al-Saidi 2023-01-03 05:33:29 UTC
to make it really slow, search for

[\x{202A}-\x{202F}]
Comment 2 Kåre Särs 2023-01-03 19:44:52 UTC
I can also reproduce the issue.

As a workaround, for now at least, you can use the Search & Replace plugin. With the plugin, the search is done in less than a second.
Comment 3 Fahad Al-Saidi 2023-01-04 03:28:19 UTC
@Kåre Särs Thanks for the workaround it is really fast in search, but unfortunately  Search & Replace plugin doesn't have option for replacing all matches or at least I couldn't find it.
Comment 4 Kåre Särs 2023-01-04 17:08:02 UTC
There is the "Replace checked" button that replaces all the checked items. After a search all matches are checked until you un-check them
Comment 5 Fahad Al-Saidi 2023-01-05 02:54:05 UTC
(In reply to Kåre Särs from comment #4)
> There is the "Replace checked" button that replaces all the checked items.
> After a search all matches are checked until you un-check them

Thanks. It works.
Comment 6 Bug Janitor Service 2023-01-11 07:49:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/466