From 748b38d80f3db5f962cc7c94794d67cf7544dfa0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 23 Aug 2019 13:54:25 +0200 Subject: [PATCH] GTextEditor: Fix obvious bug in find() We forgot to rewind the search cursor after a partial match, which would make us fail to find "xxy" in "xxxxy". --- Libraries/LibGUI/GTextEditor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/LibGUI/GTextEditor.cpp b/Libraries/LibGUI/GTextEditor.cpp index 841cef6493..6200499111 100644 --- a/Libraries/LibGUI/GTextEditor.cpp +++ b/Libraries/LibGUI/GTextEditor.cpp @@ -1125,6 +1125,8 @@ GTextRange GTextEditor::find(const StringView& needle, const GTextPosition& star if (needle_index >= needle.length()) return { start_of_potential_match, next_position_after(position) }; } else { + if (needle_index > 0) + position = start_of_potential_match; needle_index = 0; } position = next_position_after(position);