Skip to content

Commit c1b9484

Browse files
TimothyLukeclaude
andcommitted
#1984 Allow Sequence Editor to open in combat
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017wmCKbEwmEgWW8SpWnXJhC
1 parent 9a17df9 commit c1b9484

2 files changed

Lines changed: 78 additions & 88 deletions

File tree

GSE/Localization/ModL_enUS.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,6 @@ Authors who enable |cFF00BFFFAuto-Accept|r in GSE Options will have incoming upd
836836
-- =========================================================================
837837

838838
-- Used in GSE_GUI/Editor.lua
839-
L["You cannot open a new Sequence Editor window while you are in combat. Please exit combat and then try again."] = true
840839

841840
-- Used in GSE_GUI/Editor_Macro.lua
842841
L["Used by Sequences"] = true

GSE_GUI/Editor.lua

Lines changed: 78 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -7478,96 +7478,87 @@ function GSE.CreateEditor()
74787478
end
74797479

74807480
function GSE.ShowSequences()
7481-
if not InCombatLockdown() or (GSE.PlayerSpellsLoaded and GSE.PlayerSpellsLoaded()) then
7482-
local editframe = GSE.CreateEditor()
7483-
editframe.ManageTree()
7484-
if GSE.HydrateLoadedSequenceActionIcons then GSE.HydrateLoadedSequenceActionIcons() end
7485-
local lastSequencePath = GSE.GUI.GetLastSequenceEditorPath and GSE.GUI.GetLastSequenceEditorPath()
7486-
local classID = tostring(GSE.GetCurrentClassID and GSE.GetCurrentClassID() or "")
7487-
7488-
-- Restore the last-opened sequence. In "show all classes" mode the tree
7489-
-- shows every class, so restore it regardless of the class/spec the player
7490-
-- is currently on. In current-class mode the tree only shows the current
7491-
-- class, so only restore the path when it belongs to the current class
7492-
-- (otherwise it would not be visible); fall back to the current class.
7493-
-- Paths look like "Sequences\001<classID>\001..." so check segment 2.
7494-
local showingAllClasses = GSEOptions and GSEOptions.filterList and GSEOptions.filterList[Statics.All]
7495-
if lastSequencePath and not showingAllClasses then
7496-
local parts = {("\001"):split(lastSequencePath)}
7497-
local pathClass = parts[2] and tostring(parts[2]) or ""
7498-
if pathClass ~= classID then
7499-
lastSequencePath = nil -- wrong class, fall back to current class
7500-
end
7501-
end
7502-
7503-
local selectPath = lastSequencePath or "Sequences\001NewSequence"
7504-
local treeStatus = editframe.treeContainer.status or editframe.treeContainer.localstatus
7505-
7506-
-- Attached opening rules: when the tree is DETACHED, a newly opened editor
7507-
-- opens to wherever the detached tree is already working (e.g. DK Sequence 1)
7508-
-- instead of refreshing the tree to the normal current-class/last sequence.
7509-
-- It mirrors the detached tree's expansion + scroll and selects that node
7510-
-- silently, so opening the window does not refresh or jump the floating menu.
7511-
local adopted = false
7512-
if GSE.GUI.navDetached and GSE.GUI.floatOwner and GSE.GUI.floatOwner ~= editframe then
7513-
local srcTree = GSE.GUI.floatOwner.treeContainer
7514-
local srcStatus = srcTree and (srcTree.status or srcTree.localstatus)
7515-
if srcStatus and srcStatus.selected then
7516-
-- Mirror expansion + scroll (copy the table, don't share the reference)
7517-
treeStatus.groups = treeStatus.groups or {}
7518-
for k in pairs(treeStatus.groups) do treeStatus.groups[k] = nil end
7519-
for k, v in pairs(srcStatus.groups or {}) do treeStatus.groups[k] = v end
7520-
treeStatus.scrollvalue = srcStatus.scrollvalue or 0
7521-
-- Open to the detached tree's current node, silently: SetSelected loads
7522-
-- the editor content via OnGroupSelected without expanding/RefreshTree.
7523-
editframe.forceTreeSelection = true
7524-
if editframe.treeContainer.SetSelected then
7525-
editframe.treeContainer:SetSelected(srcStatus.selected)
7526-
end
7527-
-- One-shot: stop SyncTrees from RevealSelection-refreshing this tree
7528-
-- when the float follows to it (its menu already matches the source).
7529-
editframe.treeContainer.skipNextReveal = true
7530-
adopted = true
7531-
end
7532-
end
7533-
7534-
if not adopted then
7535-
treeStatus.groups["Sequences"] = true
7536-
if classID ~= "" then
7537-
treeStatus.groups["Sequences\001" .. classID] = true
7538-
end
7539-
-- Also expand the class that owns the sequence we are selecting, so a
7540-
-- last sequence on a different class (All-classes mode) is revealed.
7541-
if lastSequencePath then
7542-
local lp = {("\001"):split(lastSequencePath)}
7543-
if lp[2] and lp[2] ~= "" then
7544-
treeStatus.groups["Sequences\001" .. tostring(lp[2])] = true
7545-
end
7546-
end
7547-
if GSE.GUI.SelectEditorTreePath then
7548-
GSE.GUI.SelectEditorTreePath(editframe, selectPath)
7549-
else
7550-
editframe.treeContainer:SelectByValue(selectPath)
7551-
end
7552-
end
7553-
7554-
-- Restore last non-sequence area (Variables, Macros, Keybindings) if that was last open
7555-
local seOpts = GSEOptions and GSEOptions.frameLocations and GSEOptions.frameLocations.sequenceeditor
7556-
local lastArea = seOpts and seOpts.lastArea
7557-
if lastArea and lastArea ~= "Sequences" and editframe.RestoreLastNode then
7558-
C_Timer.After(0.1, function() editframe.RestoreLastNode() end)
7481+
local editframe = GSE.CreateEditor()
7482+
editframe.ManageTree()
7483+
if GSE.HydrateLoadedSequenceActionIcons then GSE.HydrateLoadedSequenceActionIcons() end
7484+
local lastSequencePath = GSE.GUI.GetLastSequenceEditorPath and GSE.GUI.GetLastSequenceEditorPath()
7485+
local classID = tostring(GSE.GetCurrentClassID and GSE.GetCurrentClassID() or "")
7486+
7487+
-- Restore the last-opened sequence. In "show all classes" mode the tree
7488+
-- shows every class, so restore it regardless of the class/spec the player
7489+
-- is currently on. In current-class mode the tree only shows the current
7490+
-- class, so only restore the path when it belongs to the current class
7491+
-- (otherwise it would not be visible); fall back to the current class.
7492+
-- Paths look like "Sequences\001<classID>\001..." so check segment 2.
7493+
local showingAllClasses = GSEOptions and GSEOptions.filterList and GSEOptions.filterList[Statics.All]
7494+
if lastSequencePath and not showingAllClasses then
7495+
local parts = {("\001"):split(lastSequencePath)}
7496+
local pathClass = parts[2] and tostring(parts[2]) or ""
7497+
if pathClass ~= classID then
7498+
lastSequencePath = nil -- wrong class, fall back to current class
7499+
end
7500+
end
7501+
7502+
local selectPath = lastSequencePath or "Sequences\001NewSequence"
7503+
local treeStatus = editframe.treeContainer.status or editframe.treeContainer.localstatus
7504+
7505+
-- Attached opening rules: when the tree is DETACHED, a newly opened editor
7506+
-- opens to wherever the detached tree is already working (e.g. DK Sequence 1)
7507+
-- instead of refreshing the tree to the normal current-class/last sequence.
7508+
-- It mirrors the detached tree's expansion + scroll and selects that node
7509+
-- silently, so opening the window does not refresh or jump the floating menu.
7510+
local adopted = false
7511+
if GSE.GUI.navDetached and GSE.GUI.floatOwner and GSE.GUI.floatOwner ~= editframe then
7512+
local srcTree = GSE.GUI.floatOwner.treeContainer
7513+
local srcStatus = srcTree and (srcTree.status or srcTree.localstatus)
7514+
if srcStatus and srcStatus.selected then
7515+
-- Mirror expansion + scroll (copy the table, don't share the reference)
7516+
treeStatus.groups = treeStatus.groups or {}
7517+
for k in pairs(treeStatus.groups) do treeStatus.groups[k] = nil end
7518+
for k, v in pairs(srcStatus.groups or {}) do treeStatus.groups[k] = v end
7519+
treeStatus.scrollvalue = srcStatus.scrollvalue or 0
7520+
-- Open to the detached tree's current node, silently: SetSelected loads
7521+
-- the editor content via OnGroupSelected without expanding/RefreshTree.
7522+
editframe.forceTreeSelection = true
7523+
if editframe.treeContainer.SetSelected then
7524+
editframe.treeContainer:SetSelected(srcStatus.selected)
7525+
end
7526+
-- One-shot: stop SyncTrees from RevealSelection-refreshing this tree
7527+
-- when the float follows to it (its menu already matches the source).
7528+
editframe.treeContainer.skipNextReveal = true
7529+
adopted = true
7530+
end
7531+
end
7532+
7533+
if not adopted then
7534+
treeStatus.groups["Sequences"] = true
7535+
if classID ~= "" then
7536+
treeStatus.groups["Sequences\001" .. classID] = true
7537+
end
7538+
-- Also expand the class that owns the sequence we are selecting, so a
7539+
-- last sequence on a different class (All-classes mode) is revealed.
7540+
if lastSequencePath then
7541+
local lp = {("\001"):split(lastSequencePath)}
7542+
if lp[2] and lp[2] ~= "" then
7543+
treeStatus.groups["Sequences\001" .. tostring(lp[2])] = true
7544+
end
7545+
end
7546+
if GSE.GUI.SelectEditorTreePath then
7547+
GSE.GUI.SelectEditorTreePath(editframe, selectPath)
7548+
else
7549+
editframe.treeContainer:SelectByValue(selectPath)
75597550
end
7551+
end
75607552

7561-
SetSequenceEditorOpenPreference(true, "sequences")
7562-
editframe:Show()
7563-
else
7564-
GSE.Print(
7565-
L[
7566-
"You cannot open a new Sequence Editor window while you are in combat. Please exit combat and then try again."
7567-
],
7568-
Statics.DebugModules["Editor"]
7569-
)
7553+
-- Restore last non-sequence area (Variables, Macros, Keybindings) if that was last open
7554+
local seOpts = GSEOptions and GSEOptions.frameLocations and GSEOptions.frameLocations.sequenceeditor
7555+
local lastArea = seOpts and seOpts.lastArea
7556+
if lastArea and lastArea ~= "Sequences" and editframe.RestoreLastNode then
7557+
C_Timer.After(0.1, function() editframe.RestoreLastNode() end)
75707558
end
7559+
7560+
SetSequenceEditorOpenPreference(true, "sequences")
7561+
editframe:Show()
75717562
end
75727563

75737564
local function remoteSeqences(message, seqName)

0 commit comments

Comments
 (0)