Skip to content

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

Open
joey-wheeler99 wants to merge 1 commit into
Redot-Engine:masterfrom
joey-wheeler99:master
Open

fix: add margin to file thumbnails in file explorer window#1338
joey-wheeler99 wants to merge 1 commit 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 list when using thumbnail display mode.

@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

Walkthrough

The filesystem dock now applies a horizontal separation of 10 between file items in thumbnail display mode.

Changes

Filesystem thumbnail spacing

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

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 spacing for file thumbnails in the file explorer.
Linked Issues check ✅ Passed The change increases thumbnail spacing and directly addresses issue #670 in the horizontal File Manager layout.
Out of Scope Changes check ✅ Passed The only change adjusts thumbnail spacing, which is directly related to the linked issue and PR objective.
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

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 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

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

2 participants