ronantakizawa/codereview-bench huggingface dataset:
Repository: godotengine/godot
File: editor/scene/canvas_item_editor_plugin.cpp (C++)

Code before:

		case NOTIFICATION_APPLICATION_FOCUS_OUT:
		case NOTIFICATION_WM_WINDOW_FOCUS_OUT: {
			if (drag_type != DRAG_NONE) {
				_commit_drag();
			}
		} break;
	}
}

void CanvasItemEditor::_selection_changed() {
	_update_lock_and_group_button();
	if (!selected_from_canvas) {
		_reset_drag();
	}
	selected_from_canvas = false;

	if (temp_pivot != Vector2(Math::INF, Math::INF)) {
		temp_pivot = Vector2(Math::INF, Math::INF);
		viewport->queue_redraw();
	}

	// Check to redraw to clear anything drawn from visible selections if no selections are visible.
	bool has_visible = false;
	for (const KeyValue<Node *, Object *> &E : editor_selection->get_selection()) {
		CanvasItem *ci = Object::cast_to<CanvasItem>(E.key);
		if (!ci || !ci->is_visible_in_tree()) {
			continue;
		}

		Viewport *vp = ci->get_viewport();
		if (vp && !vp->is_visible_subviewport()) {
			continue;
		}

		CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(ci);
		if (se) {
			has_visible = true;
			break;
		}
	}
	if (had_visible_selection != has_visible) {
		if (!has_visible) {
			viewport->queue_redraw();
		}
		had_visible_selection = has_visible;
	}
}

void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
	if (!p_canvas_item) {

Review comment (suggestion):
```suggestion
	for (const KeyValue<ObjectID, Object *> &E : editor_selection->get_selection()) {
		CanvasItem *ci = ObjectDB::get_instance<CanvasItem>(E.key);
```

Code after:
			}
		} break;
	}
}

void CanvasItemEditor::_selection_changed() {
	_update_lock_and_group_button();
	if (!selected_from_canvas) {
		_reset_drag();
	}
	selected_from_canvas = false;

	if (temp_pivot != Vector2(Math::INF, Math::INF)) {
		temp_pivot = Vector2(Math::INF, Math::INF);
		viewport->queue_redraw();
	}

	// Check to redraw to clear anything drawn from visible selections if no selections are visible.
	bool has_visible = false;
	for (const KeyValue<ObjectID, Object *> &E : editor_selection->get_selection()) {
		CanvasItem *ci = ObjectDB::get_instance<CanvasItem>(E.key);
		if (!ci || !ci->is_visible_in_tree()) {
			continue;
		}

		Viewport *vp = ci->get_viewport();
		if (vp && !vp->is_visible_subviewport()) {
			continue;
		}

		CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(ci);
		if (se) {
			has_visible = true;
			break;
		}
	}
	if (had_visible_selection != has_visible) {
		if (!has_visible) {
			viewport->queue_redraw();
		}
		had_visible_selection = has_visible;
	}
}

void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
	if (!p_canvas_item) {
		return;
	}

	Array selection = editor_selection->get_selected_nodes();
	if (selection.size() != 1 || Object::cast_to<Node>(selection[0]) != p_canvas_item) {
Repository: godotengine/godot
File: editor/editor_data.cpp (C++)

Code before:
	node_list_changed = true;
	Object *meta = nullptr;
	for (Object *E : editor_plugins) {
		meta = E->call("_get_editor_data", p_node);
		if (meta) {
			break;
		}
	}
	selection[nid] = meta;

	p_node->connect(SceneStringName(tree_exiting), callable_mp(this, &EditorSelection::_node_removed).bind(p_node), CONNECT_ONE_SHOT);
}

void EditorSelection::remove_node(Node *p_node) {
	ERR_FAIL_NULL(p_node);
	ObjectID nid = p_node->get_instance_id();
	if (!selection.has(nid)) {
		return;
	}

	changed = true;
	node_list_changed = true;
	Object *meta = selection[nid];
	if (meta) {
		memdelete(meta);
	}
	selection.erase(nid);

	p_node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &EditorSelection::_node_removed));
}

bool EditorSelection::is_selected(Node *p_node) const {
	if (!p_node) {
		return false;
	}
	ObjectID nid = p_node->get_instance_id();
	return selection.has(nid);
}

void EditorSelection::_bind_methods() {
	ClassDB::bind_method(D_METHOD("clear"), &EditorSelection::clear);
	ClassDB::bind_method(D_METHOD("add_node", "node"), &EditorSelection::add_node);
	ClassDB::bind_method(D_METHOD("remove_node", "node"), &EditorSelection::remove_node);
	ClassDB::bind_method(D_METHOD("get_selected_nodes"), &EditorSelection::get_selected_nodes);
	ClassDB::bind_method(D_METHOD("get_top_selected_nodes"), &EditorSelection::get_top_selected_nodes);
#ifndef DISABLE_DEPRECATED
	ClassDB::bind_method(D_METHOD("get_transformable_selected_nodes"), &EditorSelection::get_top_selected_nodes);
#endif // DISABLE_DEPRECATED
	ADD_SIGNAL(MethodInfo("selection_changed"));
}


Review comment (suggestion):
Unrelated, but
```suggestion
	memdelete_notnull(meta);
```

Code after:
	memdelete_notnull(meta);
	selection.erase(nid);
	changed = true;
	node_list_changed = true;
}

void EditorSelection::add_node(Node *p_node) {
	ERR_FAIL_NULL(p_node);
	ERR_FAIL_COND(!p_node->is_inside_tree());
	ObjectID nid = p_node->get_instance_id();
	if (selection.has(nid)) {
		return;
	}

	changed = true;
	node_list_changed = true;
	Object *meta = nullptr;
	for (Object *E : editor_plugins) {
		meta = E->call("_get_editor_data", p_node);
		if (meta) {
			break;
		}
	}
	selection[nid] = meta;

	p_node->connect(SceneStringName(tree_exiting), callable_mp(this, &EditorSelection::_node_removed).bind(p_node), CONNECT_ONE_SHOT);
}

void EditorSelection::remove_node(Node *p_node) {
	ERR_FAIL_NULL(p_node);
	ObjectID nid = p_node->get_instance_id();
	if (!selection.has(nid)) {
		return;
	}

	changed = true;
	node_list_changed = true;
	Object *meta = selection[nid];
	memdelete_notnull(meta);
	selection.erase(nid);

	p_node->disconnect(SceneStringName(tree_exiting), callable_mp(this, &EditorSelection::_node_removed));
}

bool EditorSelection::is_selected(Node *p_node) const {
	if (!p_node) {
		return false;
	}
	return selection.has(p_node->get_instance_id());
}
Repository: godotengine/godot
File: scene/gui/text_edit.cpp (C++)

Code before:
		return false;
	}
	return text.get_line_wrap_amount(p_line) > 0;
}

int TextEdit::get_line_wrap_count(int p_line) const {
	ERR_FAIL_INDEX_V(p_line, text.size(), 0);

	if (!is_line_wrapped(p_line)) {
		return 0;
	}

	return text.get_line_wrap_amount(p_line);
}

int TextEdit::get_line_wrap_index_at_column(int p_line, int p_column) const {
	ERR_FAIL_INDEX_V(p_line, text.size(), 0);
	ERR_FAIL_COND_V(p_column < 0, 0);
	ERR_FAIL_COND_V(p_column > text[p_line].length(), 0);

	if (!is_line_wrapped(p_line)) {
		return 0;
	}

	/* Loop through wraps in the line text until we get to the column. */
	int wrap_index = 0;
	int col = 0;
	Vector<String> lines = get_line_wrapped_text(p_line);
	for (int i = 0; i < lines.size(); i++) {
		wrap_index = i;
		col += lines[wrap_index].length();
		if (col > p_column) {
			break;
		}
	}
	return wrap_index;
}

Vector<String> TextEdit::get_line_wrapped_text(int p_line) const {
	ERR_FAIL_INDEX_V(p_line, text.size(), Vector<String>());

	Vector<String> lines;
	if (!is_line_wrapped(p_line)) {
		lines.push_back(text[p_line]);
		return lines;
	}

	const String &line_text = text[p_line];
	Vector<Vector2i> line_ranges = text.get_line_wrap_ranges(p_line);
	for (int i = 0; i < line_ranges.size(); i++) {
		lines.push_back(line_text.substr(line_ranges[i].x, line_ranges[i].y - line_ranges[i].x));

Review comment (suggestion):
`get_line_wrap_ranges` always uses non-ime text buffer, so mixing it with `text.get_text_with_ime` for column range won't fully work. There are some other places it is mixed as well.

Code after:
		return false;
	}
	return text.get_line_wrap_amount(p_line) > 0;
}

int TextEdit::get_line_wrap_count(int p_line) const {
	ERR_FAIL_INDEX_V(p_line, text.size(), 0);

	if (!is_line_wrapped(p_line)) {
		return 0;
	}

	return text.get_line_wrap_amount(p_line);
}

int TextEdit::get_line_wrap_index_at_column(int p_line, int p_column) const {
	ERR_FAIL_INDEX_V(p_line, text.size(), 0);
	ERR_FAIL_COND_V(p_column < 0, 0);
	ERR_FAIL_COND_V(p_column > text.get_text_with_ime(p_line).length(), 0);

	if (!is_line_wrapped(p_line)) {
		return 0;
	}

	// Loop through wraps in the line text until we get to the column.
	const Vector<Vector2i> line_ranges = text.get_line_wrap_ranges(p_line);
	for (int i = 0; i < line_ranges.size(); i++) {
		if (line_ranges[i].y > p_column) {
			return i;
		}
	}
	return line_ranges.is_empty() ? 0 : line_ranges.size() - 1;
}

Vector<String> TextEdit::get_line_wrapped_text(int p_line) const {
	ERR_FAIL_INDEX_V(p_line, text.size(), Vector<String>());

	Vector<String> lines;
	if (!is_line_wrapped(p_line)) {
		lines.push_back(text.get_text_with_ime(p_line));
		return lines;
	}

	const String &line_text = text.get_text_with_ime(p_line);
	const Vector<Vector2i> line_ranges = text.get_line_wrap_ranges(p_line);
	lines.reserve(line_ranges.size());
	for (int i = 0; i < line_ranges.size(); i++) {
		lines.push_back(line_text.substr(line_ranges[i].x, line_ranges[i].y - line_ranges[i].x));
	}

	return lines;
Repository: godotengine/godot
File: scene/resources/packed_scene.cpp (C++)

Code before:
}

////////////////

void PackedScene::_set_bundled_scene(const Dictionary &p_scene) {
	state->set_bundled_scene(p_scene);
}

Dictionary PackedScene::_get_bundled_scene() const {
	return state->get_bundled_scene();
}

Error PackedScene::pack(Node *p_scene) {
	return state->pack(p_scene);
}

void PackedScene::clear() {
	state->clear();
}

void PackedScene::reload_from_file() {
	String path = get_path();

	if (path.begins_with("uid://")) {
		path = ResourceUID::get_singleton()->get_id_path(ResourceUID::get_singleton()->text_to_id(get_path()));
	}

	if (!path.is_resource_file()) {
		return;
	}

	Ref<PackedScene> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
	if (s.is_null()) {
		return;
	}

	// Backup the loaded_state
	Ref<SceneState> loaded_state = s->get_state();
	// This assigns a new state to s->state
	// We do this because of the next step
	s->recreate_state();
	// This has a side-effect to clear s->state
	copy_from(s);
	// Then, we copy the backed-up loaded_state to state
	state->copy_from(loaded_state);
}

bool PackedScene::can_instantiate() const {
	return state->can_instantiate();
}


Review comment (suggestion):
`resource_path` property is always a filename, so this should be unnecessary.

Code after:
}

////////////////

void PackedScene::_set_bundled_scene(const Dictionary &p_scene) {
	state->set_bundled_scene(p_scene);
}

Dictionary PackedScene::_get_bundled_scene() const {
	return state->get_bundled_scene();
}

Error PackedScene::pack(Node *p_scene) {
	return state->pack(p_scene);
}

void PackedScene::clear() {
	state->clear();
}

void PackedScene::reload_from_file() {
	String path = get_path();
	if (!path.is_resource_file()) {
		return;
	}

	Ref<PackedScene> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
	if (s.is_null()) {
		return;
	}

	// Backup the loaded_state
	Ref<SceneState> loaded_state = s->get_state();
	// This assigns a new state to s->state
	// We do this because of the next step
	s->recreate_state();
	// This has a side-effect to clear s->state
	copy_from(s);
	// Then, we copy the backed-up loaded_state to state
	state->copy_from(loaded_state);
}

bool PackedScene::can_instantiate() const {
	return state->can_instantiate();
}

Node *PackedScene::instantiate(GenEditState p_edit_state) const {
#ifndef TOOLS_ENABLED
	ERR_FAIL_COND_V_MSG(p_edit_state != GEN_EDIT_STATE_DISABLED, nullptr, "Edit state is only for editors, does not work without tools compiled.");
#endif
Repository: godotengine/godot
File: scene/resources/packed_scene.cpp (C++)

Code before:
}

SceneState::SceneState() {
}

////////////////

void PackedScene::_set_bundled_scene(const Dictionary &p_scene) {
	state->set_bundled_scene(p_scene);
}

Dictionary PackedScene::_get_bundled_scene() const {
	return state->get_bundled_scene();
}

Error PackedScene::pack(Node *p_scene) {
	return state->pack(p_scene);
}

void PackedScene::clear() {
	state->clear();
}

void PackedScene::reload_from_file() {
	String path = get_path();
	path = ResourceUID::ensure_path(path); //If it's a resource uid, then convert to real path.

	if (!path.is_resource_file()) {
		return;
	}

	Ref<PackedScene> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
	if (s.is_null()) {
		return;
	}

	// Backup the loaded_state
	Ref<SceneState> loaded_state = s->get_state();
	// This assigns a new state to s->state
	// We do this because of the next step
	s->recreate_state();
	// This has a side-effect to clear s->state
	copy_from(s);
	// Then, we copy the backed-up loaded_state to state
	state->copy_from(loaded_state);
}

bool PackedScene::can_instantiate() const {
	return state->can_instantiate();
}


Review comment (suggestion):
Instead of modifying PackedScene, you should make a change in `editor_autoload_settings`:
https://github.com/godotengine/godot/blob/019889d1da32e13dfd3bea0f66f7c38ff90a6eb8/editor/settings/editor_autoload_settings.cpp#L396

Code after:
}

SceneState::SceneState() {
}

////////////////

void PackedScene::_set_bundled_scene(const Dictionary &p_scene) {
	state->set_bundled_scene(p_scene);
}

Dictionary PackedScene::_get_bundled_scene() const {
	return state->get_bundled_scene();
}

Error PackedScene::pack(Node *p_scene) {
	return state->pack(p_scene);
}

void PackedScene::clear() {
	state->clear();
}

void PackedScene::reload_from_file() {
	String path = get_path();
	if (!path.is_resource_file()) {
		return;
	}

	Ref<PackedScene> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
	if (s.is_null()) {
		return;
	}

	// Backup the loaded_state
	Ref<SceneState> loaded_state = s->get_state();
	// This assigns a new state to s->state
	// We do this because of the next step
	s->recreate_state();
	// This has a side-effect to clear s->state
	copy_from(s);
	// Then, we copy the backed-up loaded_state to state
	state->copy_from(loaded_state);
}

bool PackedScene::can_instantiate() const {
	return state->can_instantiate();
}

Node *PackedScene::instantiate(GenEditState p_edit_state) const {
#ifndef TOOLS_ENABLED
Repository: godotengine/godot
File: platform/linuxbsd/wayland/wayland_thread.cpp (C++)

Code before:
	}

	{
		// Iterate through all of the outputs to find if any got removed.
		// FIXME: This is a very bruteforce approach.
		List<struct wl_output *>::Element *it = registry->wl_outputs.front();
		while (it) {
			// Iterate through all of the screens to find if any got removed.
			struct wl_output *wl_output = it->get();
			ERR_FAIL_NULL(wl_output);

			ScreenState *ss = wl_output_get_screen_state(wl_output);

			if (ss->wl_output_name == name) {
				registry->wl_outputs.erase(it);

				memdelete(ss);
				wl_output_destroy(wl_output);

				return;
			}

			it = it->next();
		}
	}

	if (name == registry->wp_fifo_manager_name) {
		registry->wp_fifo_manager_name = 0;
	}
}

void WaylandThread::_wl_surface_on_enter(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output) {
	if (!wl_output || !wl_proxy_is_godot((struct wl_proxy *)wl_output)) {
		// This won't have the right data bound to it. Not worth it and would probably
		// just break everything.
		return;
	}

	WindowState *ws = (WindowState *)data;
	ERR_FAIL_NULL(ws);

	DEBUG_LOG_WAYLAND_THREAD(vformat("Window entered output %x.\n", (size_t)wl_output));

	ws->wl_outputs.insert(wl_output);

	// Workaround for buffer scaling as there's no guaranteed way of knowing the
	// preferred scale.
	// TODO: Skip this branch for newer `wl_surface`s once we add support for
	// `wl_surface::preferred_buffer_scale`
	if (ws->preferred_fractional_scale == 0) {
		window_state_update_size(ws, ws->rect.size.width, ws->rect.size.height);

Review comment (suggestion):
Don't forget to also destroy it `WaylandThread::destroy()`.

Code after:

		return;
	}

	if (name == registry->wp_text_input_manager_name) {
		if (registry->wp_text_input_manager) {
			zwp_text_input_manager_v3_destroy(registry->wp_text_input_manager);
			registry->wp_text_input_manager = nullptr;
		}

		registry->wp_text_input_manager_name = 0;

		for (struct wl_seat *wl_seat : registry->wl_seats) {
			SeatState *ss = wl_seat_get_seat_state(wl_seat);
			ERR_FAIL_NULL(ss);

			zwp_text_input_v3_destroy(ss->wp_text_input);
			ss->wp_text_input = nullptr;
		}

		return;
	}

	if (name == registry->wp_pointer_warp_name) {
		if (registry->wp_pointer_warp) {
			wp_pointer_warp_v1_destroy(registry->wp_pointer_warp);
			registry->wp_pointer_warp = nullptr;
		}

		registry->wp_pointer_warp_name = 0;

		return;
	}

	{
		// Iterate through all of the seats to find if any got removed.
		List<struct wl_seat *>::Element *E = registry->wl_seats.front();
		while (E) {
			struct wl_seat *wl_seat = E->get();
			List<struct wl_seat *>::Element *N = E->next();

			SeatState *ss = wl_seat_get_seat_state(wl_seat);
			ERR_FAIL_NULL(ss);

			if (ss->wl_seat_name == name) {
				if (wl_seat) {
					wl_seat_destroy(wl_seat);
				}

				if (ss->wl_data_device) {
					wl_data_device_destroy(ss->wl_data_device);
Repository: godotengine/godot
File: platform/linuxbsd/wayland/wayland_thread.cpp (C++)

Code before:

		pointer_set_constraint(PointerConstraint::LOCKED);
		pointer_set_hint(p_to);

		pointer_set_constraint(old_constraint);

		return;
	}

	SeatState *ss = wl_seat_get_seat_state(wl_seat_current);
	if (!ss) {
		return;
	}

	WindowState *ws = window_get_state(ss->pointer_data.pointed_id);
	if (!ws) {
		return;
	}

	// NOTE: It looks like it's not really recommended to convert from
	// "godot-space" to "wayland-space" and in general I received mixed feelings
	// discussing about this. I'm not really sure about the maths behind this but,
	// oh well. ¯\_(ツ)_/¯
	// See: https://oftc.irclog.whitequark.org/wayland/2023-08-23#1692756914-1692816818
	int wl_pos_x = std::round(p_to.x / window_state_get_scale_factor(ws));
	int wl_pos_y = std::round(p_to.y / window_state_get_scale_factor(ws));
	

	if (ss) {
		seat_state_warp_pointer(ss, wl_pos_x, wl_pos_y);
	}
}
WaylandThread::PointerConstraint WaylandThread::pointer_get_constraint() const {
	return pointer_constraint;
}

BitField<MouseButtonMask> WaylandThread::pointer_get_button_mask() const {
	SeatState *ss = wl_seat_get_seat_state(wl_seat_current);

	if (ss) {
		return ss->pointer_data.pressed_button_mask;
	}

	return BitField<MouseButtonMask>();
}

Error WaylandThread::init() {
#ifdef SOWRAP_ENABLED
#ifdef DEBUG_ENABLED
	int dylibloader_verbose = 1;
#else

Review comment (suggestion):
```suggestion
	int wl_pos_x = Math::round(p_to.x / window_state_get_scale_factor(ws));
	int wl_pos_y = Math::round(p_to.y / window_state_get_scale_factor(ws));
```
Please use the built in methods

Code after:
	   // manually to the engine (hoping that it worked). In the worst case it'll
	   // get reset by the next configure event.
			ws.mode = DisplayServer::WINDOW_MODE_MINIMIZED;
		} break;

		case DisplayServer::WINDOW_MODE_MAXIMIZED: {
			if (ws.xdg_toplevel) {
				xdg_toplevel_set_maximized(ws.xdg_toplevel);
			}

#ifdef LIBDECOR_ENABLED
			if (ws.libdecor_frame) {
				libdecor_frame_set_maximized(ws.libdecor_frame);
			}
#endif // LIBDECOR_ENABLED
		} break;

		case DisplayServer::WINDOW_MODE_FULLSCREEN:
		case DisplayServer::WINDOW_MODE_EXCLUSIVE_FULLSCREEN: {
			if (ws.xdg_toplevel) {
				xdg_toplevel_set_fullscreen(ws.xdg_toplevel, nullptr);
			}

#ifdef LIBDECOR_ENABLED
			if (ws.libdecor_frame) {
				libdecor_frame_set_fullscreen(ws.libdecor_frame, nullptr);
			}
#endif // LIBDECOR_ENABLED
		} break;

		default: {
		} break;
	}
}

void WaylandThread::window_set_borderless(DisplayServer::WindowID p_window_id, bool p_borderless) {
	ERR_FAIL_COND(!windows.has(p_window_id));
	WindowState &ws = windows[p_window_id];

	if (ws.xdg_toplevel_decoration) {
		if (p_borderless) {
			// We implement borderless windows by simply asking the compositor to let
			// us handle decorations (we don't).
			zxdg_toplevel_decoration_v1_set_mode(ws.xdg_toplevel_decoration, ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE);
		} else {
			zxdg_toplevel_decoration_v1_set_mode(ws.xdg_toplevel_decoration, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
		}
	}

#ifdef LIBDECOR_ENABLED
	if (ws.libdecor_frame) {
Repository: godotengine/godot
File: editor/project_manager/quick_settings_dialog.cpp (C++)

Code before:
void QuickSettingsDialog::_update_current_values() {
#ifndef ANDROID_ENABLED
	// Language options.
	{
		const String current_lang = EDITOR_GET("interface/editor/editor_language");

		for (int i = 0; i < editor_languages.size(); i++) {
			const String &lang_value = editor_languages[i].get_slicec('/', 0);
			if (current_lang == lang_value) {
				language_option_button->set_text(editor_languages[i].get_slicec('/', 1));
				language_option_button->select(i);
				break;
			}
		}
	}
#endif
	// Style options.
	{
		const String current_style = EDITOR_GET("interface/theme/style");

		for (int i = 0; i < editor_styles.size(); i++) {
			const String &style_value = editor_styles[i];
			if (current_style == style_value) {
				style_option_button->set_text(current_style);
				style_option_button->select(i);
				style_option_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
			}
		}
	}

	// Theme options.
	{
		const String current_theme = EDITOR_GET("interface/theme/color_preset");

		for (int i = 0; i < editor_themes.size(); i++) {
			const String &theme_value = editor_themes[i];
			if (current_theme == theme_value) {
				theme_option_button->set_text(current_theme);
				theme_option_button->select(i);
				theme_option_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);

				custom_theme_label->set_visible(current_theme == "Custom");
			}
		}
	}

	// Scale options.
	{
		const int current_scale = EDITOR_GET("interface/editor/display_scale");

		for (int i = 0; i < editor_scales.size(); i++) {

Review comment (suggestion):
```suggestion
				style_option_button->select(i);
```
`set_text()` is unnecessary, auto-translate mode should be set when creating the button.

Code after:
	}
}

void QuickSettingsDialog::_update_current_values() {
#ifndef ANDROID_ENABLED
	// Language options.
	{
		const String current_lang = EDITOR_GET("interface/editor/editor_language");

		for (int i = 0; i < editor_languages.size(); i++) {
			const String &lang_value = editor_languages[i].get_slicec('/', 0);
			if (current_lang == lang_value) {
				language_option_button->set_text(editor_languages[i].get_slicec('/', 1));
				language_option_button->select(i);
				break;
			}
		}
	}
#endif
	// Style options.
	{
		const String current_style = EDITOR_GET("interface/theme/style");

		for (int i = 0; i < editor_styles.size(); i++) {
			const String &style_value = editor_styles[i];
			if (current_style == style_value) {
				style_option_button->select(i);
			}
		}
	}

	// Theme options.
	{
		const String current_theme = EDITOR_GET("interface/theme/color_preset");

		for (int i = 0; i < editor_themes.size(); i++) {
			const String &theme_value = editor_themes[i];
			if (current_theme == theme_value) {
				theme_option_button->set_text(current_theme);
				theme_option_button->select(i);
				theme_option_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);

				custom_theme_label->set_visible(current_theme == "Custom");
			}
		}
	}

	// Scale options.
	{
		const int current_scale = EDITOR_GET("interface/editor/display_scale");