Fix comments and indentation in .gdshaderinc files

Fixes #78205
The handling of comments and indentation in the shader editor
wasn't considering shader include files.
This commit is contained in:
jpcerrone 2023-07-07 11:18:30 -03:00
parent 443820686c
commit 71b8a9d274
1 changed files with 3 additions and 5 deletions

View File

@ -646,13 +646,13 @@ void TextShaderEditor::_menu_option(int p_option) {
shader_editor->move_lines_down(); shader_editor->move_lines_down();
} break; } break;
case EDIT_INDENT: { case EDIT_INDENT: {
if (shader.is_null()) { if (shader.is_null() && shader_inc.is_null()) {
return; return;
} }
shader_editor->get_text_editor()->indent_lines(); shader_editor->get_text_editor()->indent_lines();
} break; } break;
case EDIT_UNINDENT: { case EDIT_UNINDENT: {
if (shader.is_null()) { if (shader.is_null() && shader_inc.is_null()) {
return; return;
} }
shader_editor->get_text_editor()->unindent_lines(); shader_editor->get_text_editor()->unindent_lines();
@ -668,12 +668,10 @@ void TextShaderEditor::_menu_option(int p_option) {
shader_editor->get_text_editor()->set_line_wrapping_mode(wrap == TextEdit::LINE_WRAPPING_BOUNDARY ? TextEdit::LINE_WRAPPING_NONE : TextEdit::LINE_WRAPPING_BOUNDARY); shader_editor->get_text_editor()->set_line_wrapping_mode(wrap == TextEdit::LINE_WRAPPING_BOUNDARY ? TextEdit::LINE_WRAPPING_NONE : TextEdit::LINE_WRAPPING_BOUNDARY);
} break; } break;
case EDIT_TOGGLE_COMMENT: { case EDIT_TOGGLE_COMMENT: {
if (shader.is_null()) { if (shader.is_null() && shader_inc.is_null()) {
return; return;
} }
shader_editor->toggle_inline_comment("//"); shader_editor->toggle_inline_comment("//");
} break; } break;
case EDIT_COMPLETE: { case EDIT_COMPLETE: {
shader_editor->get_text_editor()->request_code_completion(); shader_editor->get_text_editor()->request_code_completion();