mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Fixed issue clearing duplicate key binds
This commit is contained in:
parent
6e988b90aa
commit
e2337e7ac1
2 changed files with 28 additions and 2 deletions
|
@ -9,7 +9,7 @@ namespace IDE
|
|||
{
|
||||
public KeyCode mKeyCode;
|
||||
public KeyFlags mKeyFlags;
|
||||
|
||||
|
||||
public int GetHashCode()
|
||||
{
|
||||
return (int)mKeyCode | (int)mKeyFlags << 16;
|
||||
|
@ -121,10 +121,21 @@ namespace IDE
|
|||
class CommandMap : IDECommandBase
|
||||
{
|
||||
public Dictionary<KeyState, IDECommandBase> mMap = new .() ~ delete _;
|
||||
public List<IDECommandBase> mFailValues ~ delete _;
|
||||
|
||||
public List<IDECommandBase> FailValues
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mFailValues == null)
|
||||
mFailValues = new .();
|
||||
return mFailValues;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
for (let val in mMap.Values)
|
||||
void Release(IDECommandBase val)
|
||||
{
|
||||
if (var cmdMap = val as CommandMap)
|
||||
delete cmdMap;
|
||||
|
@ -136,6 +147,15 @@ namespace IDE
|
|||
ideCommand.mNext = null;
|
||||
}
|
||||
}
|
||||
|
||||
for (let val in mMap.Values)
|
||||
Release(val);
|
||||
if (mFailValues != null)
|
||||
{
|
||||
for (var val in mFailValues)
|
||||
Release(val);
|
||||
mFailValues.Clear();
|
||||
}
|
||||
mMap.Clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -894,7 +894,10 @@ namespace IDE
|
|||
{
|
||||
curCmdMap = (*valuePtr) as CommandMap;
|
||||
if (curCmdMap == null)
|
||||
{
|
||||
curCmdMap.FailValues.Add(ideCommand);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -907,7 +910,10 @@ namespace IDE
|
|||
if (checkPrevCmd.mContextFlags == ideCommand.mContextFlags)
|
||||
gApp.OutputLineSmart("ERROR: The same key is bound for '{0}' and '{1}'", checkPrevCmd.mName, entry.mCommand);
|
||||
if (checkPrevCmd.mNext == null)
|
||||
{
|
||||
curCmdMap.FailValues.Add(ideCommand);
|
||||
break;
|
||||
}
|
||||
checkPrevCmd = checkPrevCmd.mNext;
|
||||
}
|
||||
checkPrevCmd.mNext = ideCommand;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue