Repository: godotengine/godot
File: editor/editor_settings_dialog.cpp (C++)

Code before:
	restart_hb->add_child(restart_icon);
	restart_label = memnew(Label);
	restart_label->set_text(TTR("The editor must be restarted for changes to take effect."));
	restart_hb->add_child(restart_label);
	restart_hb->add_spacer();
	Button *restart_button = memnew(Button);
	restart_button->connect(SceneStringName(pressed), callable_mp(this, &EditorSettingsDialog::_editor_restart));
	restart_hb->add_child(restart_button);
	restart_button->set_text(TTR("Save & Restart"));
	restart_close_button = memnew(Button);
	restart_close_button->set_flat(true);
	restart_close_button->connect(SceneStringName(pressed), callable_mp(this, &EditorSettingsDialog::_editor_restart_close));
	restart_hb->add_child(restart_close_button);
	restart_container->hide();

	// Shortcuts Tab

	tab_shortcuts = memnew(VBoxContainer);

	tabs->add_child(tab_shortcuts);
	tab_shortcuts->set_name(TTR("Shortcuts"));

	HBoxContainer *top_hbox = memnew(HBoxContainer);
	top_hbox->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	tab_shortcuts->add_child(top_hbox);

	shortcut_search_box = memnew(LineEdit);
	shortcut_search_box->set_placeholder(TTR("Filter by Name"));
	shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	top_hbox->add_child(shortcut_search_box);
	shortcut_search_box->connect(SceneStringName(text_changed), callable_mp(this, &EditorSettingsDialog::_filter_shortcuts));

	shortcut_search_by_event = memnew(EventListenerLineEdit);
	shortcut_search_by_event->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	shortcut_search_by_event->set_stretch_ratio(0.75);
	shortcut_search_by_event->set_allowed_input_types(INPUT_KEY);
	shortcut_search_by_event->connect("event_changed", callable_mp(this, &EditorSettingsDialog::_filter_shortcuts_by_event));
	shortcut_search_by_event->connect(SceneStringName(focus_entered), callable_mp((AcceptDialog *)this, &AcceptDialog::set_close_on_escape).bind(false));
	shortcut_search_by_event->connect(SceneStringName(focus_exited), callable_mp((AcceptDialog *)this, &AcceptDialog::set_close_on_escape).bind(true));
	top_hbox->add_child(shortcut_search_by_event);

	clear_all_search = memnew(Button);
	clear_all_search->set_text(TTR("Clear All"));
	clear_all_search->set_tooltip_text(TTR("Clear all search filters."));
	clear_all_search->connect(SceneStringName(pressed), callable_mp(shortcut_search_box, &LineEdit::clear));
	clear_all_search->connect(SceneStringName(pressed), callable_mp(shortcut_search_by_event, &EventListenerLineEdit::clear_event));
	top_hbox->add_child(clear_all_search);

	shortcuts = memnew(Tree);
	shortcuts->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
	shortcuts->set_v_size_flags(Control::SIZE_EXPAND_FILL);

Review comment (suggestion):
```suggestion
	// Calling add_property_hint overrides the existing hint.
```

Code after:
	int index_moving_from = selected->get_meta("event_index");

	Array events = selected->get_parent()->get_meta("events");

	Variant event_moved = events[index_moving_from];
	events.remove_at(index_moving_from);
	events.insert(target_event_index, event_moved);

	String ident = selected->get_parent()->get_meta("shortcut_identifier");
	if (selected->get_meta("is_action")) {
		_update_builtin_action(ident, events);
	} else {
		_update_shortcut_events(ident, events);
	}
}

void EditorSettingsDialog::_tabs_tab_changed(int p_tab) {
	_focus_current_search_box();

	// When tab has switched, shortcuts may have changed.
	_update_dynamic_property_hints();
	inspector->get_inspector()->update_tree();
}

void EditorSettingsDialog::_update_dynamic_property_hints() {
	// Calling add_property_hint overrides the existing hint.
	EditorSettings *settings = EditorSettings::get_singleton();
	settings->add_property_hint(_create_mouse_shortcut_property_info("editors/3d/navigation/orbit_mouse_button", "spatial_editor/viewport_orbit_modifier_1", "spatial_editor/viewport_orbit_modifier_2"));
	settings->add_property_hint(_create_mouse_shortcut_property_info("editors/3d/navigation/pan_mouse_button", "spatial_editor/viewport_pan_modifier_1", "spatial_editor/viewport_pan_modifier_2"));
	settings->add_property_hint(_create_mouse_shortcut_property_info("editors/3d/navigation/zoom_mouse_button", "spatial_editor/viewport_zoom_modifier_1", "spatial_editor/viewport_zoom_modifier_2"));
}

PropertyInfo EditorSettingsDialog::_create_mouse_shortcut_property_info(const String &p_property_name, const String &p_shortcut_1_name, const String &p_shortcut_2_name) {
	String hint_string;
	hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
	hint_string += "Left Mouse,";
	hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
	hint_string += "Middle Mouse,";
	hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
	hint_string += "Right Mouse";

	return PropertyInfo(Variant::INT, p_property_name, PROPERTY_HINT_ENUM, hint_string);
}

String EditorSettingsDialog::_get_shortcut_button_string(const String &p_shortcut_name) {
	String button_string;
	Ref<Shortcut> shortcut_ref = EditorSettings::get_singleton()->get_shortcut(p_shortcut_name);
	Array events = shortcut_ref->get_events();
	for (Ref<InputEvent> input_event : events) {
		button_string += input_event->as_text() + " + ";
	}