Skip to content

feat(inventory-list): add a setting for the spacing between columns#175

Open
zndxcvbn wants to merge 5 commits into
mainfrom
feat-column-margin
Open

feat(inventory-list): add a setting for the spacing between columns#175
zndxcvbn wants to merge 5 commits into
mainfrom
feat-column-margin

Conversation

@zndxcvbn

@zndxcvbn zndxcvbn commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Resolve #153.

Summary by CodeRabbit

  • New Features
    • Column spacing in list layouts is now configurable, letting you adjust horizontal margins between columns for finer layout control. The setting has a default value of zero so existing layouts remain unchanged unless customized.

@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9a467ee2-5357-4dbd-b5fa-09e95d5c6305

📥 Commits

Reviewing files that changed from the base of the PR and between 9459d5e and 7739fea.

📒 Files selected for processing (1)
  • source/swfsources.cmake
✅ Files skipped from review due to trivial changes (1)
  • source/swfsources.cmake

📝 Walkthrough

Walkthrough

Adds a configurable column-margin setting and wires it into the ListLayout component so list column x-positions (and label positions) are offset by the configured margin; also exposes the new ActionScript file to two SWF build targets and defines a default of 0 in config.

Changes

Cohort / File(s) Summary
Configuration
data/interface/skyui/config.txt
Add defaults.columnMargin = 0 to define the global default column spacing.
Layout Logic
source/actionscript/Common/skyui/components/list/ListLayout.as
Introduce columnMargin property (getter/setter), initialize from defaults, and apply an offset in updateLayout so text columns and labels shift horizontally by the configured margin.
Build Configuration
source/swfsources.cmake
Include Common/skyui/components/list/ListLayout.as in SOURCES for craftingmenu and skyui_inventorylists SWF targets.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • doodlum
🚥 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 accurately summarizes the main change: adding a configurable setting for column spacing in the inventory list.
Linked Issues check ✅ Passed The PR implements the core requirement from #153: a configurable column spacing setting that alters horizontal placement between columns.
Out of Scope Changes check ✅ Passed All changes directly support the column margin feature; no unrelated modifications are present in the three affected files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@zndxcvbn zndxcvbn changed the title feat(item-menu): add column margin feat(item-menu): add a setting for indentation between columns Apr 22, 2026
@zndxcvbn zndxcvbn changed the title feat(item-menu): add a setting for indentation between columns feat(inventory-list): add a setting for indentation between columns Apr 22, 2026
@zndxcvbn zndxcvbn force-pushed the feat-column-margin branch from e49fa89 to 76b03c0 Compare April 25, 2026 18:53
@zndxcvbn zndxcvbn closed this Apr 25, 2026
@zndxcvbn zndxcvbn force-pushed the feat-column-margin branch from 76b03c0 to 84955d8 Compare April 25, 2026 18:55
@zndxcvbn zndxcvbn reopened this Apr 25, 2026
@zndxcvbn zndxcvbn marked this pull request as ready for review April 25, 2026 19:09
@zndxcvbn zndxcvbn changed the title feat(inventory-list): add a setting for indentation between columns feat(inventory-list): add a setting for the spacing between columns Apr 25, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (3)
source/actionscript/Common/skyui/components/list/ListLayout.as (3)

173-174: Verify defaults.columnMargin is always parsed as a Number.

config.txt provides 0 (numeric), so this works today, but if a user mis-edits the config (e.g. quotes the value), _columnMargin could become a string and the later this.columnMargin * multiplier would yield NaN, propagating into labelX/x. A defensive Number(...) coercion (or fallback to 0) would harden the construction path.

🛡️ Proposed defensive coercion
-        if (this._columnMargin == undefined)
-            this._columnMargin = this._defaultsData.columnMargin;
+        if (this._columnMargin == undefined) {
+            var m = Number(this._defaultsData.columnMargin);
+            this._columnMargin = isNaN(m) ? 0 : m;
+        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/actionscript/Common/skyui/components/list/ListLayout.as` around lines
173 - 174, Ensure _defaultsData.columnMargin is coerced to a numeric value when
initializing _columnMargin in ListLayout.as: if this._columnMargin is undefined,
assign this._columnMargin = Number(this._defaultsData.columnMargin) || 0 so that
subsequent uses like columnMargin * multiplier and calculations for labelX/x
never produce NaN; update the initialization that references
_defaultsData.columnMargin (and any other places reading defaults.columnMargin)
to use Number(...) with a fallback.

478-478: Minor: visibleColumnCount is reused later — fine, but consider naming.

Just a readability note — visibleColumnCount equals _columnLayoutData.length and is only consumed inside the loop below. No change requested; flagging only because the variable is introduced here without other use.

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

In `@source/actionscript/Common/skyui/components/list/ListLayout.as` at line 478,
The local var visibleColumnCount duplicates _columnLayoutData.length but is only
used inside the loop; improve readability by either renaming visibleColumnCount
to something clearer (e.g., columnLayoutCount) or by removing the temporary and
using this._columnLayoutData.length directly where referenced; update references
in the loop that currently use visibleColumnCount to match the chosen approach
(affecting the variable visibleColumnCount and its use with
this._columnLayoutData).

143-146: Setter does not trigger a relayout.

If the intent (per #153) is to drive this from the MCM at runtime, calling set columnMargin(...) alone won't visually update existing lists — updateLayout() is only invoked from changeFilterFlag, selectColumn, and restoreColumnState. Consider invoking updateLayout() (and dispatching layoutChange) inside the setter when the value actually changes, or document that callers must trigger a refresh.

♻️ Proposed change
     public function set columnMargin(a_margin: Number)
     {
-        this._columnMargin = a_margin;
+        if (this._columnMargin == a_margin)
+            return;
+        this._columnMargin = a_margin;
+        this.updateLayout();
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/actionscript/Common/skyui/components/list/ListLayout.as` around lines
143 - 146, The setter for columnMargin in ListLayout.as updates _columnMargin
but does not trigger a visual relayout; modify the public function set
columnMargin(a_margin: Number) to compare a_margin with this._columnMargin and
if it changed, assign the new value, call updateLayout() and dispatch the layout
change event (same event used elsewhere, e.g. "layoutChange" or the class'
existing layout-dispatch mechanism) so existing lists refresh immediately;
reference the _columnMargin field, the columnMargin setter, and the
updateLayout()/layoutChange dispatch pattern used by
changeFilterFlag/selectColumn/restoreColumnState.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@source/actionscript/Common/skyui/components/list/ListLayout.as`:
- Line 484: The new columnMargin setting (defaults.columnMargin and the
ListLayout property) isn't exposed in the MCM UI; add a corresponding control in
configpanel.xml (e.g., slider or numeric input labeled "Column Margin") bound to
defaults.columnMargin, and update ModConfigPanel to read and write that field
when loading/saving config so the MCM reflects and persists the value; ensure
the control's id/key matches the config key used by ModConfigPanel so changes
update the defaults.columnMargin used by ListLayout.

---

Nitpick comments:
In `@source/actionscript/Common/skyui/components/list/ListLayout.as`:
- Around line 173-174: Ensure _defaultsData.columnMargin is coerced to a numeric
value when initializing _columnMargin in ListLayout.as: if this._columnMargin is
undefined, assign this._columnMargin = Number(this._defaultsData.columnMargin)
|| 0 so that subsequent uses like columnMargin * multiplier and calculations for
labelX/x never produce NaN; update the initialization that references
_defaultsData.columnMargin (and any other places reading defaults.columnMargin)
to use Number(...) with a fallback.
- Line 478: The local var visibleColumnCount duplicates _columnLayoutData.length
but is only used inside the loop; improve readability by either renaming
visibleColumnCount to something clearer (e.g., columnLayoutCount) or by removing
the temporary and using this._columnLayoutData.length directly where referenced;
update references in the loop that currently use visibleColumnCount to match the
chosen approach (affecting the variable visibleColumnCount and its use with
this._columnLayoutData).
- Around line 143-146: The setter for columnMargin in ListLayout.as updates
_columnMargin but does not trigger a visual relayout; modify the public function
set columnMargin(a_margin: Number) to compare a_margin with this._columnMargin
and if it changed, assign the new value, call updateLayout() and dispatch the
layout change event (same event used elsewhere, e.g. "layoutChange" or the
class' existing layout-dispatch mechanism) so existing lists refresh
immediately; reference the _columnMargin field, the columnMargin setter, and the
updateLayout()/layoutChange dispatch pattern used by
changeFilterFlag/selectColumn/restoreColumnState.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2615ad7b-a599-4714-870d-89bfd45b7835

📥 Commits

Reviewing files that changed from the base of the PR and between 1523d12 and 9459d5e.

📒 Files selected for processing (3)
  • data/interface/skyui/config.txt
  • source/actionscript/Common/skyui/components/list/ListLayout.as
  • source/swfsources.cmake

c = 0;
for (var i = 0; i < this._columnList.length; i++) {
var col = _columnList[i];
var col = this._columnList[i];

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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Look for any MCM wiring that would set columnMargin at runtime.
rg -nP -C3 '\bcolumnMargin\b'
# Look for new MCM entries referencing column spacing.
rg -nP -C3 '(column.?margin|column.?spacing|COLUMN_MARGIN)' --iglob '*.xml' --iglob '*.txt' --iglob '*.as'

Repository: doodlum/SkyUI-Community

Length of output: 3144


🏁 Script executed:

# Find configpanel.xml file
fd -type f 'configpanel.xml' --ignore-case

Repository: doodlum/SkyUI-Community

Length of output: 238


🏁 Script executed:

# Check if there are any MCM-related configuration files that might reference columns or spacing
fd -type f -e xml | head -20

Repository: doodlum/SkyUI-Community

Length of output: 238


🏁 Script executed:

# Search for any modconfigmenu or MCM references in the codebase
rg -i 'modconfigmenu|modconfig' --iglob '*.xml' --iglob '*.as' -l

Repository: doodlum/SkyUI-Community

Length of output: 49


🏁 Script executed:

# Find configpanel.xml file
fd 'configpanel' -e xml

Repository: doodlum/SkyUI-Community

Length of output: 100


🏁 Script executed:

# List all XML files to understand structure
fd -e xml | head -30

Repository: doodlum/SkyUI-Community

Length of output: 954


🏁 Script executed:

# Search for ModConfigPanel or modconfigmenu references
rg -i 'modconfigpanel|modconfig' -l

Repository: doodlum/SkyUI-Community

Length of output: 128


🏁 Script executed:

# Read the configpanel.xml file
cat source/swf/skyui/configpanel.xml

Repository: doodlum/SkyUI-Community

Length of output: 50381


🏁 Script executed:

# Search configpanel.xml specifically for spacing or margin related entries
rg -i '(spacing|margin|column)' source/swf/skyui/configpanel.xml

Repository: doodlum/SkyUI-Community

Length of output: 18892


🏁 Script executed:

# Look for source XML files that might be used to configure MCM options
find source -type f -name "*.xml" | grep -i config

Repository: doodlum/SkyUI-Community

Length of output: 100


🏁 Script executed:

# Search in data/interface for configuration XML files
find data -type f -name "*.xml" | head -20

Repository: doodlum/SkyUI-Community

Length of output: 49


🏁 Script executed:

# Look for .swf source files or MXML that might define configuration
find source -type f \( -name "*.mxml" -o -name "*Config*" \)

Repository: doodlum/SkyUI-Community

Length of output: 270


🏁 Script executed:

# Read the ConfigPanel.as file to see its structure
wc -l source/actionscript/ModConfigPanel/ConfigPanel.as

Repository: doodlum/SkyUI-Community

Length of output: 121


🏁 Script executed:

# Search for column-related configuration in ConfigPanel.as
rg -i 'column|margin|spacing' source/actionscript/ModConfigPanel/ConfigPanel.as -n

Repository: doodlum/SkyUI-Community

Length of output: 169


🏁 Script executed:

# Also check what options are currently defined in ConfigPanel.as
rg -i 'case|switch|_config\[' source/actionscript/ModConfigPanel/ConfigPanel.as -n | head -40

Repository: doodlum/SkyUI-Community

Length of output: 1619


🏁 Script executed:

# Check if there are any additions to ConfigPanel.as related to columnMargin
rg 'columnMargin' source/actionscript/ModConfigPanel/ConfigPanel.as

Repository: doodlum/SkyUI-Community

Length of output: 49


🏁 Script executed:

# Look at the git diff to see what was changed in this PR
git diff --stat HEAD~1 HEAD 2>/dev/null | head -20

Repository: doodlum/SkyUI-Community

Length of output: 49


🏁 Script executed:

# Search for any reference to issue 153 or column spacing in commit messages or docs
rg -i '#153|column.*spacing|spacing.*column' . --type md --type txt 2>/dev/null | head -10

Repository: doodlum/SkyUI-Community

Length of output: 496


MCM configuration missing for column margin setting. This PR exposes columnMargin via defaults.columnMargin in config.txt and a settable property on ListLayout, but doesn't wire it into the MCM UI in ModConfigPanel/configpanel.xml. Users can only customize it by editing the config file, not through the mod configuration menu.

Is the MCM hookup intentionally a follow-up PR? If so, please clarify this in the PR description so reviewers and users understand that this PR doesn't provide end-to-end resolution of #153.

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

In `@source/actionscript/Common/skyui/components/list/ListLayout.as` at line 484,
The new columnMargin setting (defaults.columnMargin and the ListLayout property)
isn't exposed in the MCM UI; add a corresponding control in configpanel.xml
(e.g., slider or numeric input labeled "Column Margin") bound to
defaults.columnMargin, and update ModConfigPanel to read and write that field
when loading/saving config so the MCM reflects and persists the value; ensure
the control's id/key matches the config key used by ModConfigPanel so changes
update the defaults.columnMargin used by ListLayout.

@zndxcvbn zndxcvbn marked this pull request as draft April 26, 2026 19:30
@zndxcvbn zndxcvbn marked this pull request as ready for review April 29, 2026 18:36
@zndxcvbn zndxcvbn added deferred Will be considered at a later date labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deferred Will be considered at a later date

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Ability to customize spacing between columns via MCM

1 participant