Skip to content

Move script name to top#1239

Open
AR-DEV-1 wants to merge 1 commit intoRedot-Engine:masterfrom
AR-DEV-1:move-script-name-to-top
Open

Move script name to top#1239
AR-DEV-1 wants to merge 1 commit intoRedot-Engine:masterfrom
AR-DEV-1:move-script-name-to-top

Conversation

@AR-DEV-1
Copy link
Copy Markdown
Contributor

@AR-DEV-1 AR-DEV-1 commented Apr 13, 2026

TL;DR

PR in work:
image

Note

Contributed by 2LazyDevs.

Summary by CodeRabbit

  • Refactor
    • Reorganized script editor UI component positioning for improved layout efficiency.
    • Enhanced script name display synchronization when switching between open script tabs.
    • Optimized internal script selection and tab management operations.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

Walkthrough

The PR refactors the ScriptEditor UI by removing the filename Label and script_icon TextureRect elements, simplifying the tab-switching logic with local pointers, and consolidating script name label updates into the _script_selected function.

Changes

Cohort / File(s) Summary
ScriptEditor UI Refactoring
editor/script/script_editor_plugin.cpp, editor/script/script_editor_plugin.h
Removed filename Label and script_icon TextureRect member fields. Refactored _go_to_tab to use local pointers for casts instead of repeated calls. Moved script name label updates from multiple functions to _script_selected. Removed texture and label update logic from constructor, _notification, _update_members_overview, _update_help_overview_visibility, and _update_script_names.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Move script name to top' directly corresponds to the main change: relocating the script name label from a dedicated control to the top of the interface, replacing the filename control with filter_methods positioning.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@editor/script/script_editor_plugin.cpp`:
- Around line 2016-2017: Move the script_name_label update out of the list-click
path and into the centralized current-tab refresh flow: remove the set_text call
after _go_to_tab and instead update script_name_label inside the same code that
handles current-tab changes (e.g., _script_selected or the function that
_go_to_tab ultimately triggers), using script_list->get_item_text(p_idx) when a
tab is selected and explicitly clear script_name_label (set to empty) when no
tab is selected (e.g., after _update_script_names rebuilds the list and
selection is invalid); ensure any metadata-driven behavior still uses
script_list->get_item_metadata(p_idx) as before.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4d614f38-8d60-450f-8248-1ad466d91297

📥 Commits

Reviewing files that changed from the base of the PR and between 2a02d9c and 3b832a9.

📒 Files selected for processing (2)
  • editor/script/script_editor_plugin.cpp
  • editor/script/script_editor_plugin.h
💤 Files with no reviewable changes (1)
  • editor/script/script_editor_plugin.h

Comment on lines 2016 to +2017
_go_to_tab(script_list->get_item_metadata(p_idx));
script_name_label->set_text(script_list->get_item_text(p_idx));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Keep script_name_label driven by the current-tab refresh path.

Line 2017 only updates the header for list-click selection. With the old centralized filename updates removed, the label can now drift stale in states that don't pass through _script_selected()—most visibly after the last tab is closed, since _update_script_names() rebuilds the list but never clears the label when it becomes empty. I'd keep this label update centralized in the same path that handles current-tab changes and explicitly reset it when no tab is selected.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@editor/script/script_editor_plugin.cpp` around lines 2016 - 2017, Move the
script_name_label update out of the list-click path and into the centralized
current-tab refresh flow: remove the set_text call after _go_to_tab and instead
update script_name_label inside the same code that handles current-tab changes
(e.g., _script_selected or the function that _go_to_tab ultimately triggers),
using script_list->get_item_text(p_idx) when a tab is selected and explicitly
clear script_name_label (set to empty) when no tab is selected (e.g., after
_update_script_names rebuilds the list and selection is invalid); ensure any
metadata-driven behavior still uses script_list->get_item_metadata(p_idx) as
before.

@Arctis-Fireblight
Copy link
Copy Markdown
Contributor

@AR-DEV-1 I apologize for the delay in testing this, but I think this might need some more modifications to work properly with Redot.
Please see the screenshot below:
image

It should look something like this:
image

@Arctis-Fireblight
Copy link
Copy Markdown
Contributor

For giggles, I compiled master and opened the same script file.
image

This cherry picked commit is 100% the source of the regression.

@AR-DEV-1
Copy link
Copy Markdown
Contributor Author

@AR-DEV-1 I apologize for the delay in testing this, but I think this might need some more modifications to work properly with Redot.

Aight, I'll look into it later since I'm a bit busy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants