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

Igor Poboiko noreply at phabricator.kde.org
Fri May 1 07:05:33 BST 2020


poboiko created this revision.
poboiko added a reviewer: mlaurent.
Herald added a project: KDE PIM.
poboiko requested review of this revision.

REVISION 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

REPOSITORY
  R86 PIM: Text Editor

BRANCH
  replaceAll (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D29318

AFFECTED FILES
  src/texteditor/plaintexteditor/plaintexteditfindbar.cpp
  src/texteditor/richtexteditor/richtexteditfindbar.cpp

To: poboiko, mlaurent
Cc: kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200501/2d3ed1ee/attachment-0001.html>


More information about the kde-pim mailing list