[evolution/wip/mcrha/webkit-jsc-api: 286/292] EWebKitEditor: Prevent Replace-all to cycle indefinitely in some cases



commit 2f4eedc8ebbc676fa538647876667e29b9240605
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 5 18:36:38 2020 +0100

    EWebKitEditor: Prevent Replace-all to cycle indefinitely in some cases
    
    In case the search and the replace words are similar (like changing
    capitals or such and searching case insensitively), the search can
    repeat indefinitely for replace all. This makes the Replace-all
    use only search from the top of the document to the bottom, without
    wrap around, thus it'll stop at the end of the document on its own.

 src/modules/webkit-editor/e-webkit-editor.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index cfbd26d40f..51f7c721f2 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -2827,6 +2827,8 @@ webkit_editor_replace_all (EContentEditor *editor,
        e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
                "EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_GROUP, %s);", "ReplaceAll");
 
+       webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (wk_editor), 
"MoveToBeginningOfDocumentAndModifySelection");
+
        webkit_find_controller_search (wk_editor->priv->find_controller, find_text, wk_options, G_MAXUINT);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]