소스 검색

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".
Andreas Kling 6 년 전
부모
커밋
748b38d80f
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      Libraries/LibGUI/GTextEditor.cpp

+ 2 - 0
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);