Quellcode durchsuchen

GTextEditor: Fixed bug in find_prev

Find_prev returned invalid when the contents of the file were equal to
the contents of the search box.

This is due to the checker walking on an empty character at the end of
a line.
Andrew Weller vor 6 Jahren
Ursprung
Commit
b50ffaf7e1
1 geänderte Dateien mit 1 neuen und 0 gelöschten Zeilen
  1. 1 0
      Libraries/LibGUI/GTextEditor.cpp

+ 1 - 0
Libraries/LibGUI/GTextEditor.cpp

@@ -1295,6 +1295,7 @@ GTextRange GTextEditor::find_prev(const StringView& needle, const GTextPosition&
         return {};
         return {};
 
 
     GTextPosition position = start.is_valid() ? start : GTextPosition(0, 0);
     GTextPosition position = start.is_valid() ? start : GTextPosition(0, 0);
+    position = prev_position_before(position);
     GTextPosition original_position = position;
     GTextPosition original_position = position;
 
 
     GTextPosition end_of_potential_match;
     GTextPosition end_of_potential_match;