You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
#include "scene/resources/dynamic_font.h"
|
||||
|
||||
void GotoLineDialog::popup_find_line(TextEdit *p_edit) {
|
||||
|
||||
text_editor = p_edit;
|
||||
|
||||
line->set_text(itos(text_editor->cursor_get_line()));
|
||||
@@ -51,12 +50,10 @@ void GotoLineDialog::popup_find_line(TextEdit *p_edit) {
|
||||
}
|
||||
|
||||
int GotoLineDialog::get_line() const {
|
||||
|
||||
return line->get_text().to_int();
|
||||
}
|
||||
|
||||
void GotoLineDialog::ok_pressed() {
|
||||
|
||||
if (get_line() < 1 || get_line() > text_editor->get_line_count())
|
||||
return;
|
||||
text_editor->unfold_line(get_line() - 1);
|
||||
@@ -65,7 +62,6 @@ void GotoLineDialog::ok_pressed() {
|
||||
}
|
||||
|
||||
GotoLineDialog::GotoLineDialog() {
|
||||
|
||||
set_title(TTR("Go to Line"));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
@@ -88,9 +84,7 @@ GotoLineDialog::GotoLineDialog() {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
|
||||
find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
|
||||
@@ -98,10 +92,8 @@ void FindReplaceBar::_notification(int p_what) {
|
||||
hide_button->set_pressed_texture(get_icon("Close", "EditorIcons"));
|
||||
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
|
||||
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||
|
||||
set_process_unhandled_input(is_visible_in_tree());
|
||||
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
|
||||
|
||||
find_prev->set_icon(get_icon("MoveUp", "EditorIcons"));
|
||||
find_next->set_icon(get_icon("MoveDown", "EditorIcons"));
|
||||
hide_button->set_normal_texture(get_icon("Close", "EditorIcons"));
|
||||
@@ -114,7 +106,6 @@ void FindReplaceBar::_notification(int p_what) {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
Ref<InputEventKey> k = p_event;
|
||||
if (!k.is_valid() || !k->is_pressed()) {
|
||||
return;
|
||||
@@ -140,7 +131,6 @@ void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
bool FindReplaceBar::_search(uint32_t p_flags, int p_from_line, int p_from_col) {
|
||||
|
||||
int line, col;
|
||||
String text = get_search_text();
|
||||
|
||||
@@ -223,7 +213,6 @@ void FindReplaceBar::_replace() {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_replace_all() {
|
||||
|
||||
text_edit->disconnect("text_changed", this, "_editor_text_changed");
|
||||
// Line as x so it gets priority in comparison, column as y.
|
||||
Point2i orig_cursor(text_edit->cursor_get_line(), text_edit->cursor_get_column());
|
||||
@@ -313,7 +302,6 @@ void FindReplaceBar::_replace_all() {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_get_search_from(int &r_line, int &r_col) {
|
||||
|
||||
r_line = text_edit->cursor_get_line();
|
||||
r_col = text_edit->cursor_get_column();
|
||||
|
||||
@@ -360,7 +348,6 @@ void FindReplaceBar::_update_results_count() {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_update_matches_label() {
|
||||
|
||||
if (search_text->get_text().empty() || results_count == -1) {
|
||||
matches_label->hide();
|
||||
} else {
|
||||
@@ -372,7 +359,6 @@ void FindReplaceBar::_update_matches_label() {
|
||||
}
|
||||
|
||||
bool FindReplaceBar::search_current() {
|
||||
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (is_whole_words())
|
||||
@@ -387,7 +373,6 @@ bool FindReplaceBar::search_current() {
|
||||
}
|
||||
|
||||
bool FindReplaceBar::search_prev() {
|
||||
|
||||
if (!is_visible())
|
||||
popup_search(true);
|
||||
|
||||
@@ -418,7 +403,6 @@ bool FindReplaceBar::search_prev() {
|
||||
}
|
||||
|
||||
bool FindReplaceBar::search_next() {
|
||||
|
||||
if (!is_visible())
|
||||
popup_search(true);
|
||||
|
||||
@@ -451,7 +435,6 @@ bool FindReplaceBar::search_next() {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_hide_bar() {
|
||||
|
||||
if (replace_text->has_focus() || search_text->has_focus())
|
||||
text_edit->grab_focus();
|
||||
|
||||
@@ -462,7 +445,6 @@ void FindReplaceBar::_hide_bar() {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) {
|
||||
|
||||
show();
|
||||
if (p_show_only)
|
||||
return;
|
||||
@@ -495,7 +477,6 @@ void FindReplaceBar::_show_search(bool p_focus_replace, bool p_show_only) {
|
||||
}
|
||||
|
||||
void FindReplaceBar::popup_search(bool p_show_only) {
|
||||
|
||||
replace_text->hide();
|
||||
hbc_button_replace->hide();
|
||||
hbc_option_replace->hide();
|
||||
@@ -504,7 +485,6 @@ void FindReplaceBar::popup_search(bool p_show_only) {
|
||||
}
|
||||
|
||||
void FindReplaceBar::popup_replace() {
|
||||
|
||||
if (!replace_text->is_visible_in_tree()) {
|
||||
replace_text->show();
|
||||
hbc_button_replace->show();
|
||||
@@ -517,13 +497,11 @@ void FindReplaceBar::popup_replace() {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_search_options_changed(bool p_pressed) {
|
||||
|
||||
results_count = -1;
|
||||
search_current();
|
||||
}
|
||||
|
||||
void FindReplaceBar::_editor_text_changed() {
|
||||
|
||||
results_count = -1;
|
||||
if (is_visible_in_tree()) {
|
||||
preserve_cursor = true;
|
||||
@@ -533,13 +511,11 @@ void FindReplaceBar::_editor_text_changed() {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_search_text_changed(const String &p_text) {
|
||||
|
||||
results_count = -1;
|
||||
search_current();
|
||||
}
|
||||
|
||||
void FindReplaceBar::_search_text_entered(const String &p_text) {
|
||||
|
||||
if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||
search_prev();
|
||||
} else {
|
||||
@@ -548,7 +524,6 @@ void FindReplaceBar::_search_text_entered(const String &p_text) {
|
||||
}
|
||||
|
||||
void FindReplaceBar::_replace_text_entered(const String &p_text) {
|
||||
|
||||
if (selection_only->is_pressed() && text_edit->is_selection_active()) {
|
||||
_replace_all();
|
||||
_hide_bar();
|
||||
@@ -556,44 +531,36 @@ void FindReplaceBar::_replace_text_entered(const String &p_text) {
|
||||
}
|
||||
|
||||
String FindReplaceBar::get_search_text() const {
|
||||
|
||||
return search_text->get_text();
|
||||
}
|
||||
|
||||
String FindReplaceBar::get_replace_text() const {
|
||||
|
||||
return replace_text->get_text();
|
||||
}
|
||||
|
||||
bool FindReplaceBar::is_case_sensitive() const {
|
||||
|
||||
return case_sensitive->is_pressed();
|
||||
}
|
||||
|
||||
bool FindReplaceBar::is_whole_words() const {
|
||||
|
||||
return whole_words->is_pressed();
|
||||
}
|
||||
|
||||
bool FindReplaceBar::is_selection_only() const {
|
||||
|
||||
return selection_only->is_pressed();
|
||||
}
|
||||
|
||||
void FindReplaceBar::set_error(const String &p_label) {
|
||||
|
||||
emit_signal("error", p_label);
|
||||
}
|
||||
|
||||
void FindReplaceBar::set_text_edit(TextEdit *p_text_edit) {
|
||||
|
||||
results_count = -1;
|
||||
text_edit = p_text_edit;
|
||||
text_edit->connect("text_changed", this, "_editor_text_changed");
|
||||
}
|
||||
|
||||
void FindReplaceBar::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method("_unhandled_input", &FindReplaceBar::_unhandled_input);
|
||||
|
||||
ClassDB::bind_method("_editor_text_changed", &FindReplaceBar::_editor_text_changed);
|
||||
@@ -613,7 +580,6 @@ void FindReplaceBar::_bind_methods() {
|
||||
}
|
||||
|
||||
FindReplaceBar::FindReplaceBar() {
|
||||
|
||||
results_count = -1;
|
||||
replace_all_mode = false;
|
||||
preserve_cursor = false;
|
||||
@@ -706,7 +672,6 @@ FindReplaceBar::FindReplaceBar() {
|
||||
// This function should be used to handle shortcuts that could otherwise
|
||||
// be handled too late if they weren't handled here.
|
||||
void CodeTextEditor::_input(const Ref<InputEvent> &event) {
|
||||
|
||||
const Ref<InputEventKey> key_event = event;
|
||||
if (!key_event.is_valid() || !key_event->is_pressed())
|
||||
return;
|
||||
@@ -734,13 +699,10 @@ void CodeTextEditor::_input(const Ref<InputEvent> &event) {
|
||||
}
|
||||
|
||||
void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
if (mb.is_valid()) {
|
||||
|
||||
if (mb->is_pressed() && mb->get_command()) {
|
||||
|
||||
if (mb->get_button_index() == BUTTON_WHEEL_UP) {
|
||||
_zoom_in();
|
||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
||||
@@ -751,7 +713,6 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
|
||||
|
||||
Ref<InputEventMagnifyGesture> magnify_gesture = p_event;
|
||||
if (magnify_gesture.is_valid()) {
|
||||
|
||||
Ref<DynamicFont> font = text_editor->get_font("font");
|
||||
|
||||
if (font.is_valid()) {
|
||||
@@ -769,7 +730,6 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
|
||||
Ref<InputEventKey> k = p_event;
|
||||
|
||||
if (k.is_valid()) {
|
||||
|
||||
if (k->is_pressed()) {
|
||||
if (ED_IS_SHORTCUT("script_editor/zoom_in", p_event)) {
|
||||
_zoom_in();
|
||||
@@ -809,7 +769,6 @@ void CodeTextEditor::_reset_zoom() {
|
||||
}
|
||||
|
||||
void CodeTextEditor::_line_col_changed() {
|
||||
|
||||
String line = text_editor->get_line(text_editor->cursor_get_line());
|
||||
|
||||
int positional_column = 0;
|
||||
@@ -832,7 +791,6 @@ void CodeTextEditor::_line_col_changed() {
|
||||
}
|
||||
|
||||
void CodeTextEditor::_text_changed() {
|
||||
|
||||
if (text_editor->is_insert_text_operation()) {
|
||||
code_complete_timer->start();
|
||||
}
|
||||
@@ -847,7 +805,6 @@ void CodeTextEditor::_code_complete_timer_timeout() {
|
||||
}
|
||||
|
||||
void CodeTextEditor::_complete_request() {
|
||||
|
||||
List<ScriptCodeCompletionOption> entries;
|
||||
String ctext = text_editor->get_text_for_completion();
|
||||
_code_complete_script(ctext, &entries);
|
||||
@@ -909,14 +866,12 @@ Ref<Texture> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOpti
|
||||
}
|
||||
|
||||
void CodeTextEditor::_font_resize_timeout() {
|
||||
|
||||
if (_add_font_size(font_resize_val)) {
|
||||
font_resize_val = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool CodeTextEditor::_add_font_size(int p_delta) {
|
||||
|
||||
Ref<DynamicFont> font = text_editor->get_font("font");
|
||||
|
||||
if (font.is_valid()) {
|
||||
@@ -934,7 +889,6 @@ bool CodeTextEditor::_add_font_size(int p_delta) {
|
||||
}
|
||||
|
||||
void CodeTextEditor::update_editor_settings() {
|
||||
|
||||
text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting"));
|
||||
text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences"));
|
||||
text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line"));
|
||||
@@ -969,7 +923,6 @@ void CodeTextEditor::trim_trailing_whitespace() {
|
||||
for (int i = 0; i < text_editor->get_line_count(); i++) {
|
||||
String line = text_editor->get_line(i);
|
||||
if (line.ends_with(" ") || line.ends_with("\t")) {
|
||||
|
||||
if (!trimed_whitespace) {
|
||||
text_editor->begin_complex_operation();
|
||||
trimed_whitespace = true;
|
||||
@@ -1473,7 +1426,6 @@ void CodeTextEditor::set_edit_state(const Variant &p_state) {
|
||||
}
|
||||
|
||||
void CodeTextEditor::set_error(const String &p_error) {
|
||||
|
||||
error->set_text(p_error);
|
||||
if (p_error != "") {
|
||||
error->set_default_cursor_shape(CURSOR_POINTING_HAND);
|
||||
@@ -1496,7 +1448,6 @@ void CodeTextEditor::goto_error() {
|
||||
}
|
||||
|
||||
void CodeTextEditor::_update_font() {
|
||||
|
||||
text_editor->add_font_override("font", get_font("source", "EditorFonts"));
|
||||
|
||||
error->add_font_override("font", get_font("status_source", "EditorFonts"));
|
||||
@@ -1513,7 +1464,6 @@ void CodeTextEditor::_update_font() {
|
||||
}
|
||||
|
||||
void CodeTextEditor::_on_settings_change() {
|
||||
|
||||
_update_font();
|
||||
|
||||
font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size");
|
||||
@@ -1570,7 +1520,6 @@ void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
void CodeTextEditor::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
_load_theme_settings();
|
||||
@@ -1606,13 +1555,11 @@ void CodeTextEditor::set_warning_nb(int p_warning_nb) {
|
||||
}
|
||||
|
||||
void CodeTextEditor::toggle_bookmark() {
|
||||
|
||||
int line = text_editor->cursor_get_line();
|
||||
text_editor->set_line_as_bookmark(line, !text_editor->is_line_set_as_bookmark(line));
|
||||
}
|
||||
|
||||
void CodeTextEditor::goto_next_bookmark() {
|
||||
|
||||
List<int> bmarks;
|
||||
text_editor->get_bookmarks(&bmarks);
|
||||
if (bmarks.size() <= 0) {
|
||||
@@ -1638,7 +1585,6 @@ void CodeTextEditor::goto_next_bookmark() {
|
||||
}
|
||||
|
||||
void CodeTextEditor::goto_prev_bookmark() {
|
||||
|
||||
List<int> bmarks;
|
||||
text_editor->get_bookmarks(&bmarks);
|
||||
if (bmarks.size() <= 0) {
|
||||
@@ -1664,7 +1610,6 @@ void CodeTextEditor::goto_prev_bookmark() {
|
||||
}
|
||||
|
||||
void CodeTextEditor::remove_all_bookmarks() {
|
||||
|
||||
List<int> bmarks;
|
||||
text_editor->get_bookmarks(&bmarks);
|
||||
|
||||
@@ -1674,7 +1619,6 @@ void CodeTextEditor::remove_all_bookmarks() {
|
||||
}
|
||||
|
||||
void CodeTextEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input);
|
||||
ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input);
|
||||
ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed);
|
||||
@@ -1709,7 +1653,6 @@ void CodeTextEditor::update_toggle_scripts_button() {
|
||||
}
|
||||
|
||||
CodeTextEditor::CodeTextEditor() {
|
||||
|
||||
code_complete_func = NULL;
|
||||
ED_SHORTCUT("script_editor/zoom_in", TTR("Zoom In"), KEY_MASK_CMD | KEY_EQUAL);
|
||||
ED_SHORTCUT("script_editor/zoom_out", TTR("Zoom Out"), KEY_MASK_CMD | KEY_MINUS);
|
||||
|
||||
Reference in New Issue
Block a user