Skip to content
Commit 408ad525 authored by Igor Poboiko's avatar Igor Poboiko
Browse files

[KPIMTextEdit/FindBar] Respect rich formatting and user settings when replacing all

Summary:
Instead of converting document to plain text, just loop over all encounters of the search string in the document and replace those.
Otherwise we will lose all formatting in `RichTextEditor`.

This way we're also able to respect the search settings (case sensitivity, whole word search).
Also, provide user with a visual indication showing how many replacements were made (the same way Kate/KWrite does it).
The latter two points also apply `PlainTextEditFindBar`.

(in principle, to avoid code duplication, we can move this to `FindBarBase`.
We only need to access `mView->document()`, which depends on the underlying text widget,
so we could add a `virtual QTextDocument *document()` method to FindBarBase and reimplement it)

Test Plan:
Tested case-sensitive and regular expression `Replace All` on a rich-text document (having a list is already sufficient),
the formatting is not messed up

Reviewers: mlaurent, dvratil

Reviewed By: mlaurent

Subscribers: dvratil, kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D29318
parent 55654e99
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment