feat(inventory-list): add quick navigation for active/equipped items#169
feat(inventory-list): add quick navigation for active/equipped items#169zndxcvbn wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughThe pull request adds a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
8115058 to
25ec76a
Compare
25ec76a to
3fccba8
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/CraftingMenu/CraftingLists.as`:
- Around line 198-205: The Ctrl+arrow/W/S shortcut block currently consumes
navigation even when the list/input is disabled or a modal/dialog is active;
modify the handler (the block checking isCtrl, kc, details.value and calling
selectEquippedItem) to first bail out when the list/input or UI is not
interactive — e.g., check this.itemList.enabled (and any modal/dialog flag such
as this.columnDialogOpen or similar) and return false so the event is not
consumed; only when the list is enabled/interactive should you proceed to
inspect details.value and call this.selectEquippedItem(dir).
In `@source/actionscript/ItemMenus/InventoryLists.as`:
- Around line 185-192: The Ctrl-key navigation block handles equipped-item
selection even when the UI list is disabled; add an early disabled-state guard
before processing isCtrl/kc events so the handler returns without changing
selection when the list is disabled (check the list's enabled/disabled flag used
by this component — e.g., this.enabled or this._disabled — and skip the block),
keeping the existing checks for isCtrl, kc, details.value and the call to
selectEquippedItem(dir) otherwise.
🪄 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: 53eb0e9a-8ee4-4b2c-ab6a-eecb0a45a954
📒 Files selected for processing (2)
source/actionscript/CraftingMenu/CraftingLists.assource/actionscript/ItemMenus/InventoryLists.as
| if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) { | ||
| if (details.value == "keyDown" || details.value == "keyHold") { | ||
| var dir = (kc == 83 || kc == 40) ? 1 : -1; | ||
| this.selectEquippedItem(dir); | ||
| return true; | ||
| } | ||
| if (details.value == "keyUp") return true; | ||
| } |
There was a problem hiding this comment.
Shortcut handler should respect disabled/modal list state
Line 198 currently consumes Ctrl navigation even when itemList input is disabled (e.g., search input or column dialog), which can cause unintended background selection changes.
Suggested fix
- if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
+ var canNavigate = !this.itemList.disableInput && !this.itemList.disableSelection && this._columnSelectDialog == undefined;
+ if (canNavigate && isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
if (details.value == "keyDown" || details.value == "keyHold") {
var dir = (kc == 83 || kc == 40) ? 1 : -1;
this.selectEquippedItem(dir);
return true;
}
if (details.value == "keyUp") return true;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) { | |
| if (details.value == "keyDown" || details.value == "keyHold") { | |
| var dir = (kc == 83 || kc == 40) ? 1 : -1; | |
| this.selectEquippedItem(dir); | |
| return true; | |
| } | |
| if (details.value == "keyUp") return true; | |
| } | |
| var canNavigate = !this.itemList.disableInput && !this.itemList.disableSelection && this._columnSelectDialog == undefined; | |
| if (canNavigate && isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) { | |
| if (details.value == "keyDown" || details.value == "keyHold") { | |
| var dir = (kc == 83 || kc == 40) ? 1 : -1; | |
| this.selectEquippedItem(dir); | |
| return true; | |
| } | |
| if (details.value == "keyUp") return true; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@source/actionscript/CraftingMenu/CraftingLists.as` around lines 198 - 205,
The Ctrl+arrow/W/S shortcut block currently consumes navigation even when the
list/input is disabled or a modal/dialog is active; modify the handler (the
block checking isCtrl, kc, details.value and calling selectEquippedItem) to
first bail out when the list/input or UI is not interactive — e.g., check
this.itemList.enabled (and any modal/dialog flag such as this.columnDialogOpen
or similar) and return false so the event is not consumed; only when the list is
enabled/interactive should you proceed to inspect details.value and call
this.selectEquippedItem(dir).
| if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) { | ||
| if (details.value == "keyDown" || details.value == "keyHold") { | ||
| var dir = (kc == 83 || kc == 40) ? 1 : -1; | ||
| this.selectEquippedItem(dir); | ||
| return true; | ||
| } | ||
| if (details.value == "keyUp") return true; | ||
| } |
There was a problem hiding this comment.
Missing disabled-state guard on Ctrl navigation
Line 185 intercepts and executes equipped-item navigation even when the list is disabled by active UI flows, allowing hidden selection changes.
Suggested fix
- if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
+ var canNavigate = !this.itemList.disableInput && !this.itemList.disableSelection && this._columnSelectDialog == undefined;
+ if (canNavigate && isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
if (details.value == "keyDown" || details.value == "keyHold") {
var dir = (kc == 83 || kc == 40) ? 1 : -1;
this.selectEquippedItem(dir);
return true;
}
if (details.value == "keyUp") return true;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) { | |
| if (details.value == "keyDown" || details.value == "keyHold") { | |
| var dir = (kc == 83 || kc == 40) ? 1 : -1; | |
| this.selectEquippedItem(dir); | |
| return true; | |
| } | |
| if (details.value == "keyUp") return true; | |
| } | |
| var canNavigate = !this.itemList.disableInput && !this.itemList.disableSelection && this._columnSelectDialog == undefined; | |
| if (canNavigate && isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) { | |
| if (details.value == "keyDown" || details.value == "keyHold") { | |
| var dir = (kc == 83 || kc == 40) ? 1 : -1; | |
| this.selectEquippedItem(dir); | |
| return true; | |
| } | |
| if (details.value == "keyUp") return true; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@source/actionscript/ItemMenus/InventoryLists.as` around lines 185 - 192, The
Ctrl-key navigation block handles equipped-item selection even when the UI list
is disabled; add an early disabled-state guard before processing isCtrl/kc
events so the handler returns without changing selection when the list is
disabled (check the list's enabled/disabled flag used by this component — e.g.,
this.enabled or this._disabled — and skip the block), keeping the existing
checks for isCtrl, kc, details.value and the call to selectEquippedItem(dir)
otherwise.
This PR introduces a quality-of-life improvement for inventory management, allowing players to quickly locate and cycle through their active gear without manual scrolling.
Key Changes:
selectEquippedIteminInventoryLists.aswhich scans the list for items with an activeequipState.Ctrl + SorCtrl + Down: Cycle forward.Ctrl + WorCtrl + Up: Cycle backward.Summary by CodeRabbit