diff options
author | kobewi <kobewi4e@gmail.com> | 2023-04-19 23:46:22 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2023-04-19 23:46:22 +0200 |
commit | ff310f0969f87e1c8d89c00e0cb635ab983b6951 (patch) | |
tree | dcc69f429d5112475a62bcb68a21686cd8a5b0c6 /editor/plugins/script_text_editor.cpp | |
parent | 27253f3eb2c78a9ad5114c92eae2036b10e1d7e0 (diff) | |
download | redot-engine-ff310f0969f87e1c8d89c00e0cb635ab983b6951.tar.gz |
Add shortcut for quick-toggling word wrap
Diffstat (limited to 'editor/plugins/script_text_editor.cpp')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 9b84c33ff2..837645310a 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1323,6 +1323,10 @@ void ScriptTextEditor::_edit_option(int p_op) { } tx->end_complex_operation(); } break; + case EDIT_TOGGLE_WORD_WRAP: { + TextEdit::LineWrappingMode wrap = code_editor->get_text_editor()->get_line_wrapping_mode(); + code_editor->get_text_editor()->set_line_wrapping_mode(wrap == TextEdit::LINE_WRAPPING_BOUNDARY ? TextEdit::LINE_WRAPPING_NONE : TextEdit::LINE_WRAPPING_BOUNDARY); + } break; case SEARCH_FIND: { code_editor->get_find_replace_bar()->popup_search(); } break; @@ -2064,6 +2068,7 @@ void ScriptTextEditor::_enable_code_editor() { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_text_select_all"), EDIT_SELECT_ALL); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/duplicate_selection"), EDIT_DUPLICATE_SELECTION); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/evaluate_selection"), EDIT_EVALUATE); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_word_wrap"), EDIT_TOGGLE_WORD_WRAP); edit_menu->get_popup()->add_separator(); { PopupMenu *sub_menu = memnew(PopupMenu); @@ -2283,6 +2288,7 @@ void ScriptTextEditor::register_editor() { ED_SHORTCUT("script_text_editor/duplicate_selection", TTR("Duplicate Selection"), KeyModifierMask::SHIFT | KeyModifierMask::CTRL | Key::D); ED_SHORTCUT_OVERRIDE("script_text_editor/duplicate_selection", "macos", KeyModifierMask::SHIFT | KeyModifierMask::META | Key::C); ED_SHORTCUT("script_text_editor/evaluate_selection", TTR("Evaluate Selection"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::E); + ED_SHORTCUT("script_text_editor/toggle_word_wrap", TTR("Toggle Word Wrap"), KeyModifierMask::ALT | Key::Z); ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT | Key::T); ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent to Spaces"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::Y); ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent to Tabs"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::I); |