Skip to content

Commit

Permalink
Merge pull request #22866 from Calinou/improve-find-in-files
Browse files Browse the repository at this point in the history
Improve the editor's Find in Files function
  • Loading branch information
akien-mga authored Oct 9, 2018
2 parents 745ae39 + f7848f2 commit 4c1a5d9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions editor/find_in_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,10 @@ FindInFilesDialog::FindInFilesDialog() {

_whole_words_checkbox = memnew(CheckBox);
_whole_words_checkbox->set_text(TTR("Whole Words"));
_whole_words_checkbox->set_pressed(true);
hbc->add_child(_whole_words_checkbox);

_match_case_checkbox = memnew(CheckBox);
_match_case_checkbox->set_text(TTR("Match Case"));
_match_case_checkbox->set_pressed(true);
hbc->add_child(_match_case_checkbox);

gc->add_child(hbc);
Expand Down Expand Up @@ -563,7 +561,7 @@ FindInFilesPanel::FindInFilesPanel() {
_cancel_button = memnew(Button);
_cancel_button->set_text(TTR("Cancel"));
_cancel_button->connect("pressed", this, "_on_cancel_button_clicked");
_cancel_button->set_disabled(true);
_cancel_button->hide();
hbc->add_child(_cancel_button);

vbc->add_child(hbc);
Expand Down Expand Up @@ -642,7 +640,7 @@ void FindInFilesPanel::start_search() {
_finder->start();

update_replace_buttons();
_cancel_button->set_disabled(false);
_cancel_button->show();
}

void FindInFilesPanel::stop_search() {
Expand All @@ -652,7 +650,7 @@ void FindInFilesPanel::stop_search() {
_status_label->set_text("");
update_replace_buttons();
set_progress_visible(false);
_cancel_button->set_disabled(true);
_cancel_button->hide();
}

void FindInFilesPanel::_notification(int p_what) {
Expand Down Expand Up @@ -688,7 +686,7 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin
// Do this first because it resets properties of the cell...
item->set_cell_mode(text_index, TreeItem::CELL_MODE_CUSTOM);

String item_text = String::num_int64(line_number) + ": " + text.replace("\t", " ");
String item_text = vformat("%3s: %s", line_number, text.replace("\t", " "));

item->set_text(text_index, item_text);
item->set_custom_draw(text_index, this, "_draw_result_text");
Expand Down Expand Up @@ -754,7 +752,7 @@ void FindInFilesPanel::_on_finished() {
_status_label->set_text(TTR("Search complete"));
update_replace_buttons();
set_progress_visible(false);
_cancel_button->set_disabled(true);
_cancel_button->hide();
}

void FindInFilesPanel::_on_cancel_button_clicked() {
Expand Down

0 comments on commit 4c1a5d9

Please sign in to comment.