1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Code style improvements to text_edit and related

This commit is contained in:
VolTer
2023-03-08 23:00:27 +01:00
parent 61630d4e1e
commit f587a21899
6 changed files with 107 additions and 126 deletions

View File

@@ -587,7 +587,7 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
return;
}
// Override new line actions, for auto indent
// Override new line actions, for auto indent.
if (k->is_action("ui_text_newline_above", true)) {
_new_line(false, true);
accept_event();
@@ -604,7 +604,7 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
return;
}
/* Remove shift otherwise actions will not match. */
// Remove shift, otherwise actions will not match.
k = k->duplicate();
k->set_shift_pressed(false);
@@ -777,8 +777,7 @@ void CodeEdit::_backspace_internal(int p_caret) {
}
}
// For space indentation we need to do a simple unindent if there are no chars to the left, acting in the
// same way as tabs.
// For space indentation we need to do a basic unindent if there are no chars to the left, acting the same way as tabs.
if (indent_using_spaces && cc != 0) {
if (get_first_non_whitespace_column(cl) >= cc) {
prev_column = cc - _calculate_spaces_till_next_left_indent(cc);
@@ -1372,7 +1371,7 @@ PackedInt32Array CodeEdit::get_bookmarked_lines() const {
return ret;
}
// executing lines
// Executing lines
void CodeEdit::set_line_as_executing(int p_line, bool p_executing) {
int mask = get_line_gutter_metadata(p_line, main_gutter);
set_line_gutter_metadata(p_line, main_gutter, p_executing ? mask | MAIN_GUTTER_EXECUTING : mask & ~MAIN_GUTTER_EXECUTING);
@@ -2064,7 +2063,7 @@ void CodeEdit::confirm_code_completion(bool p_replace) {
insert_text_at_caret(insert_text.substr(matching_chars), i);
}
//* Handle merging of symbols eg strings, brackets.
// Handle merging of symbols eg strings, brackets.
const String line = get_line(caret_line);
char32_t next_char = line[get_caret_column(i)];
char32_t last_completion_char = insert_text[insert_text.length() - 1];
@@ -2239,7 +2238,7 @@ void CodeEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("clear_bookmarked_lines"), &CodeEdit::clear_bookmarked_lines);
ClassDB::bind_method(D_METHOD("get_bookmarked_lines"), &CodeEdit::get_bookmarked_lines);
// executing lines
// Executing lines
ClassDB::bind_method(D_METHOD("set_line_as_executing", "line", "executing"), &CodeEdit::set_line_as_executing);
ClassDB::bind_method(D_METHOD("is_line_executing", "line"), &CodeEdit::is_line_executing);
ClassDB::bind_method(D_METHOD("clear_executing_lines"), &CodeEdit::clear_executing_lines);