Skip to content

fix: add margin to file thumbnails in file explorer window - #1338

Open
joey-wheeler99 wants to merge 2 commits into
Redot-Engine:masterfrom
joey-wheeler99:master
Open

fix: add margin to file thumbnails in file explorer window#1338
joey-wheeler99 wants to merge 2 commits into
Redot-Engine:masterfrom
joey-wheeler99:master

Conversation

@joey-wheeler99

@joey-wheeler99 joey-wheeler99 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This should fix #670

Summary by CodeRabbit

  • Style
    • Improved spacing between items in the file browser’s thumbnail view for clearer visual separation.

@joey-wheeler99
joey-wheeler99 requested review from a team August 2, 2026 13:00
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 57ebb78a-d506-4fc2-9c8e-2d5daff965b0

📥 Commits

Reviewing files that changed from the base of the PR and between 098d429 and f22e543.

📒 Files selected for processing (1)
  • editor/docks/filesystem_dock.cpp

Walkthrough

Thumbnail-mode file items in the filesystem dock now use a horizontal separation of 10 * EDSCALE.

Changes

Filesystem dock updates

Layer / File(s) Summary
Thumbnail spacing override
editor/docks/filesystem_dock.cpp
Thumbnail-mode file items set horizontal separation to 10 * EDSCALE.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the added margin for file thumbnails, which is the main change.
Linked Issues check ✅ Passed The change adds scaled horizontal spacing between file thumbnails and addresses the icon spacing issue in horizontal File Manager layout [#670].
Out of Scope Changes check ✅ Passed The pull request contains one focused spacing change with no unrelated code modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@editor/docks/filesystem_dock.cpp`:
- Line 970: Update the h_separation theme constant override in the
thumbnail-mode setup to multiply the value 10 by EDSCALE, matching the existing
scaling used for thumbnail_size.
- Line 970: Remove or reset the files control’s h_separation theme override in
the non-thumbnail/list-mode branch, alongside the existing thumbnail setup, so
switching modes after files->clear() restores the intended list spacing. Update
the mode-switching logic around the files control without changing
thumbnail-mode spacing.
🪄 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 Plus

Run ID: 3306c194-11e1-446b-9af1-582a58e105c0

📥 Commits

Reviewing files that changed from the base of the PR and between e1fb382 and 578a48f.

📒 Files selected for processing (1)
  • editor/docks/filesystem_dock.cpp

Comment thread editor/docks/filesystem_dock.cpp Outdated
files->set_fixed_column_width(thumbnail_size * 3 / 2);
files->set_max_text_lines(2);
files->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size));
files->add_theme_constant_override("h_separation", 10);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate files =="
fd -a 'filesystem_dock\.cpp|editor_profiler\.cpp' . | sed 's#^\./##'

echo "== relevant filesystem_dock section =="
if [ -f editor/docks/filesystem_dock.cpp ]; then
  nl -ba editor/docks/filesystem_dock.cpp | sed -n '930,1005p'
fi

echo "== search theme constant overrides and EDSCALE usage =="
rg -n "add_theme_constant_override|\"h_separation\"|EDSCALE|thumbnail_size" editor/docks/filesystem_dock.cpp editor/debugger/editor_profiler.cpp 2>/dev/null || true

echo "== nearby profiler snippet =="
if [ -f editor/debugger/editor_profiler.cpp ]; then
  nl -ba editor/debugger/editor_profiler.cpp | rg -n "h_separation|thumbnail_size|EDSCALE" -C 3
fi

Repository: Redot-Engine/redot-engine

Length of output: 368


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate files =="
fd -a 'filesystem_dock\.cpp|editor_profiler\.cp' . | sed 's#^\./##' || true

echo "== relevant filesystem_dock section =="
if [ -f editor/docks/filesystem_dock.cpp ]; then
  nl -ba editor/docks/filesystem_dock.cpp | sed -n '930,1005p'
fi

echo "== search theme constant overrides and EDSCALE usage =="
rg -n "add_theme_constant_override|\"h_separation\"|EDSCALE|thumbnail_size" editor/docks/filesystem_dock.cpp editor/debugger/editor_profiler.cpp 2>/dev/null || true

echo "== nearby profiler snippet =="
if [ -f editor/debugger/editor_profiler.cpp ]; then
  nl -ba editor/debugger/editor_profiler.cpp | rg -n "h_separation|thumbnail_size|EDSCALE" -C 3 || true
fi

Repository: Redot-Engine/redot-engine

Length of output: 368


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== relevant filesystem_dock section =="
awk 'NR>=930 && NR<=1005 {printf "%6d\t%s\n", NR, $0}' editor/docks/filesystem_dock.cpp

echo "== search theme constant overrides and EDSCALE usage =="
grep -nE 'add_theme_constant_override|"[^"]*h_separation[^"]*"|EDSCALE|thumbnail_size' editor/docks/filesystem_dock.cpp editor/debugger/editor_profiler.cpp 2>/dev/null || true

echo "== profiler relevant lines =="
grep -nE 'h_separation|thumbnail_size|EDSCALE' editor/debugger/editor_profiler.cpp 2>/dev/null -C 2 || true

Repository: Redot-Engine/redot-engine

Length of output: 8184


Scale h_separation with EDSCALE.

thumbnail_size is computed with EDSCALE, but the thumbnail-mode h_separation override remains 10. Multiply this override by EDSCALE so the separation scales with the thumbnails.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editor/docks/filesystem_dock.cpp` at line 970, Update the h_separation theme
constant override in the thumbnail-mode setup to multiply the value 10 by
EDSCALE, matching the existing scaling used for thumbnail_size.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files:"
git ls-files | rg '(^|/)filesystem_dock\.cpp$|(^|/)theme_override|local_theme_override' || true

echo
echo "filesystem_dock.cpp around relevant lines:"
sed -n '900,990p' editor/docks/filesystem_dock.cpp

echo
echo "Search h_separation/theme overrides in filesystem_dock.cpp:"
rg -n 'h_separation|theme_constant_override|clear\(\)' editor/docks/filesystem_dock.cpp

echo
echo "Nearby update_file_list outlines/functions:"
ast-grep outline editor/docks/filesystem_dock.cpp --match _update_file_list --view expanded || true
sed -n '840,930p' editor/docks/filesystem_dock.cpp

Repository: Redot-Engine/redot-engine

Length of output: 7281


🌐 Web query:

Godot Control remove_theme_constant_override docs Control local theme overrides clear remove_local_theme_override

💡 Result:

In Godot, local theme overrides for Control nodes are managed using specific methods provided by the Control class [1][2]. These overrides allow a node to ignore the values provided by its assigned Theme and use a custom, local value instead [3]. To remove a specific theme constant override that was previously set (either via code or the Inspector), you should use the remove_theme_constant_override method [2][4]. Method Signature: void remove_theme_constant_override(name: StringName) Functionality: The remove_theme_constant_override method removes the local override for a theme constant with the specified name [4]. Once removed, the Control will revert to using the value provided by its active Theme (or the default theme if no custom theme is assigned) [1][3]. Other similar methods exist for different theme data types, following the same naming convention [5][6]: - remove_theme_color_override(name: StringName) [2][5] - remove_theme_font_override(name: StringName) [5][6] - remove_theme_font_size_override(name: StringName) [5][6] - remove_theme_icon_override(name: StringName) [5][6] - remove_theme_style_override(name: StringName) [5][6] Note that these methods are distinct from the Theme class's own methods (such as clear_constant), which are used for modifying Theme resources themselves, rather than individual Control node overrides [7]. If you are working with an older version of Godot (prior to these methods being added), you would have had to manually reset values to their defaults [8], but in current Godot 4.x versions, these dedicated remove methods are the standard and recommended approach [2][4].

Citations:


Do not leave the thumbnail override in list mode.

files->clear() does not remove theme constant overrides, so switching from thumbnails back to the list view reuses the same files control while keeping h_separation set. Remove the override in the non-thumbnail branch or restore the intended list-mode spacing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editor/docks/filesystem_dock.cpp` at line 970, Remove or reset the files
control’s h_separation theme override in the non-thumbnail/list-mode branch,
alongside the existing thumbnail setup, so switching modes after files->clear()
restores the intended list spacing. Update the mode-switching logic around the
files control without changing thumbnail-mode spacing.

Shakai-Dev
Shakai-Dev previously approved these changes Aug 2, 2026

@Shakai-Dev Shakai-Dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code LGTM but needs testing

@JoltedJon

Copy link
Copy Markdown
Contributor

Is this a problem anymore? On 26.2 I couldn't see this behavior, so I think it might have already been fixed?
Here is your version
image

versus 26.2
image

@joey-wheeler99

joey-wheeler99 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Is this a problem anymore? On 26.2 I couldn't see this behavior, so I think it might have already been fixed? Here is your version image

versus 26.2 image

I can't reproduce the issue either. I added small margin to prevent the edge case of the original issue.

edit: do you think I should close this PR for now and wait to see if it pops up again?

@Arctis-Fireblight

Copy link
Copy Markdown
Contributor

I think the changes are fine. It is not entirely clear if Godot addressed this directly or not, or if this was an edge case on certain systems. I don't mind adding some explicit margin.

I also do agree with CodeRabbit's review comments here.
We can merge this after those are addressed and tested.

@joey-wheeler99

joey-wheeler99 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

I think the changes are fine. It is not entirely clear if Godot addressed this directly or not, or if this was an edge case on certain systems. I don't mind adding some explicit margin.

I also do agree with CodeRabbit's review comments here. We can merge this after those are addressed and tested.

Should I multiply the margin with EDSCALE?

@Arctis-Fireblight

Copy link
Copy Markdown
Contributor

I think the changes are fine. It is not entirely clear if Godot addressed this directly or not, or if this was an edge case on certain systems. I don't mind adding some explicit margin.
I also do agree with CodeRabbit's review comments here. We can merge this after those are addressed and tested.

Should I multiply the margin with EDSCALE?

Yes, that should have the correct effect.

@joey-wheeler99 joey-wheeler99 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Multiply margin with EDSCALE

JoltedJon
JoltedJon previously approved these changes Aug 4, 2026

@JoltedJon JoltedJon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested and looks good to me

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@editor/docks/filesystem_dock.cpp`:
- Line 3524: Update the add_icon_item call in the filesystem dock to use the
canonical “GDExtension” capitalization in both the theme icon key passed to
get_editor_theme_icon and the visible label passed to TTRC, preserving the
existing reload action.
- Around line 2563-2566: Replace the no-op FILE_MENU_RELOAD_GDEXTENSION branch
with a call to GDExtensionManager::reload_extension(p_selected[0]) and handle
its returned LoadStatus, including reporting failure to the user; alternatively
remove this menu item until reload is implemented.
🪄 Autofix

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 Plus

Run ID: 3edee5c3-d862-4004-aea0-2d3d3844c881

📥 Commits

Reviewing files that changed from the base of the PR and between 098d429 and 696b689.

📒 Files selected for processing (2)
  • editor/docks/filesystem_dock.cpp
  • editor/docks/filesystem_dock.h

Comment thread editor/docks/filesystem_dock.cpp Outdated
Comment on lines +2563 to +2566
case FILE_MENU_RELOAD_GDEXTENSION: {
// TODO: implement reload gdextension here

} break;

@coderabbitai coderabbitai Bot Aug 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not expose a no-op reload command.

This case only executes break. Selecting the menu item does not reload the extension or report an error. Call GDExtensionManager::reload_extension(p_selected[0]), handle the returned LoadStatus, or remove the menu item until the implementation is complete.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editor/docks/filesystem_dock.cpp` around lines 2563 - 2566, Replace the no-op
FILE_MENU_RELOAD_GDEXTENSION branch with a call to
GDExtensionManager::reload_extension(p_selected[0]) and handle its returned
LoadStatus, including reporting failure to the user; alternatively remove this
menu item until reload is implemented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I worked on the wrong branch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@joey-wheeler99, understood. The FILE_MENU_RELOAD_GDEXTENSION change is outside this PR’s thumbnail-spacing objective. Please remove the unrelated change when you update the branch. The finding remains valid while the no-op menu action is present.

You are interacting with an AI system.

Comment thread editor/docks/filesystem_dock.cpp Outdated
}

if (gdextension_valid) {
p_popup->add_icon_item(get_editor_theme_icon(SNAME("Reload GDEextension")), TTRC("Reload GDEextension"), FILE_MENU_RELOAD_GDEXTENSION);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the canonical GDExtension spelling.

The new label uses GDEextension. Change both strings to Reload GDExtension so the visible text and theme icon key use the project’s standard name.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editor/docks/filesystem_dock.cpp` at line 3524, Update the add_icon_item call
in the filesystem dock to use the canonical “GDExtension” capitalization in both
the theme icon key passed to get_editor_theme_icon and the visible label passed
to TTRC, preserving the existing reload action.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Icon spacing gap isn't enough in the File Manager when set to the bottom of the Editor

4 participants