Skip to content

Commit f8a5e70

Browse files
committed
Fix autoset of text_editor/external/exec_flags not working properly
1 parent 7864ac8 commit f8a5e70

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

editor/settings/editor_settings.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,18 +1171,14 @@ void EditorSettings::_load_default_visual_shader_editor_theme() {
11711171
}
11721172

11731173
String EditorSettings::_guess_exec_args_for_extenal_editor(const String &p_path) {
1174-
Ref<RegEx> regex;
1175-
regex.instantiate();
1176-
1177-
const String editor_pattern = R"([\\/]((?:jetbrains\s*)?rider(?:\s*(eap|\d{4}\.\d+|\d{4}\.\d+\s*dev)?)?|visual\s*studio\s*code|subl(ime\s*text)?|sublime_text|(g)?vim|emacs|atom|geany|kate|code|(vs)?codium)(?:\.app|\.exe|\.bat|\.sh)?)";
1178-
regex->compile(editor_pattern);
1179-
Ref<RegExMatch> editor_match = regex->search(p_path.to_lower());
1174+
Ref<RegEx> regex = RegEx::create_from_string(R"((?:jetbrains\s*)?rider(?:\s*(eap|\d{4}\.\d+|\d{4}\.\d+\s*dev)?)?|visual\s*studio\s*code|subl(ime\s*text)?|sublime_text|(g)?vim|emacs|atom|geany|kate|code|(vs)?codium)");
1175+
Ref<RegExMatch> editor_match = regex->search(p_path.to_lower().get_file().get_basename());
11801176

11811177
if (editor_match.is_null()) {
11821178
return String();
11831179
}
11841180

1185-
const String editor = editor_match->get_string(1).to_lower();
1181+
const String editor = editor_match->get_string(0).to_lower();
11861182
String new_exec_flags = "{file}";
11871183

11881184
if (editor.begins_with("rider")) {

0 commit comments

Comments
 (0)