瀏覽代碼

HackStudio: Change the collection_index for highlight selected text

Change the value for `highlight_selected_text_span_collection_index`
to avoid the conflict with `search_results_span_collection_index`.
And pass the selection instead of calling selected_text() again
Abhishek Raturi 1 年之前
父節點
當前提交
7d588db6c8
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      Userland/Libraries/LibGUI/TextEditor.cpp
  2. 1 1
      Userland/Libraries/LibGUI/TextEditor.h

+ 1 - 1
Userland/Libraries/LibGUI/TextEditor.cpp

@@ -308,7 +308,7 @@ void TextEditor::doubleclick_event(MouseEvent& event)
 
     auto selection = selected_text();
     if (!selection.is_whitespace())
-        highlight_all_occurances_of(selected_text());
+        highlight_all_occurances_of(selection);
 
     set_cursor(m_selection.end());
     update();

+ 1 - 1
Userland/Libraries/LibGUI/TextEditor.h

@@ -390,7 +390,7 @@ private:
     void on_search_results(GUI::TextRange current, Vector<GUI::TextRange> all_results);
 
     static constexpr auto search_results_span_collection_index = 1;
-    static constexpr auto highlight_selected_text_span_collection_index = 1;
+    static constexpr auto highlight_selected_text_span_collection_index = 2;
 
     Type m_type { MultiLine };
     Mode m_mode { Editable };