summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2018-10-08 23:57:20 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2018-10-09 00:00:51 +0200
commitf7848f234f7cf8092e600d034a83b3bb37c88dc4 (patch)
tree70a3d86a6e56bd6740b991f2accd0c863515c4c5 /editor
parent0063ba92075094b7cc9d36f4551080b89e0c0e50 (diff)
Improve the editor's Find in Files function
- Disable Whole Words and Match Case by default - Hide the Cancel button once the search is completed - Pad line numbers to the right for more readable search results
Diffstat (limited to 'editor')
-rw-r--r--editor/find_in_files.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index f88d1b24a6..0ccaa95fb7 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -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);
@@ -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);
@@ -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() {
@@ -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) {
@@ -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");
@@ -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() {