Skip to content

Commit 3c8bcc7

Browse files
FenikSRT4LocalIdentity
andcommitted
[ISSUE-9451] Loadout Management
Pressing F2 to rename the loadout now grabs the right name Renaming the loadout by pressing F2 would grab a table address instead of the name Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 273ef92 commit 3c8bcc7

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

spec/System/TestLoadouts_spec.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,21 @@ describe("TestLoadouts", function()
632632
end)
633633
end)
634634

635+
describe("BuildSetListControl", function()
636+
it("passes the loadout title through the F2 rename shortcut", function()
637+
build:NewLoadout("Second")
638+
local loadoutList = new("BuildSetListControl", nil, { 0, 0, 380, 200 }, build)
639+
local renameName
640+
loadoutList.RenameLoadout = function(_, name)
641+
renameName = name
642+
end
643+
644+
loadoutList:OnSelKeyDown(2, build.loadoutsList[2], "F2")
645+
646+
assert.are.equals("Second", renameName)
647+
end)
648+
end)
649+
635650
describe("BuildSetService", function()
636651
local buildSetService
637652
before_each(function()

src/Classes/BuildSetListControl.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ end
198198

199199
function BuildSetListClass:OnSelKeyDown(index, spec, key)
200200
if key == "F2" then
201-
self:RenameLoadout(spec)
201+
self:RenameLoadout(spec.title)
202202
end
203203
end
204204

@@ -220,7 +220,6 @@ function BuildSetListClass:BasicLoadoutPopup(options)
220220
local specNameLookup = self.buildSetService:SpecNameLookup()
221221
controls.edit = new("EditControl", nil, { 0, 40, 350, 20 },
222222
options.defaultName or "Default", nil, nil, 100, function(buf)
223-
print("Buf changed:", buf, specNameLookup[buf])
224223
controls.save.enabled = specNameLookup[buf] == nil and buf:match("%S")
225224
end)
226225

0 commit comments

Comments
 (0)