mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Improved handling of conflict of key chord prefix and one-key command
This commit is contained in:
parent
7c00fe87c4
commit
dd7986aaa9
2 changed files with 25 additions and 1 deletions
|
@ -953,7 +953,7 @@ namespace IDE
|
|||
curCmdMap = (*valuePtr) as CommandMap;
|
||||
if (curCmdMap == null)
|
||||
{
|
||||
curCmdMap.FailValues.Add(ideCommand);
|
||||
gApp.OutputLineSmart("ERROR: The same key is bound for '{0}' and as part of a key chord", entry.mCommand);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,6 +221,30 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
// Do chord prefix search
|
||||
for (var propEntries in mPropPage.mPropEntries.Values)
|
||||
{
|
||||
var propEntry = propEntries[0];
|
||||
let keyEntry = (KeyEntry)propEntry.mTarget;
|
||||
let origKeys = propEntry.mCurValue.Get<List<KeyState>>();
|
||||
var keys = scope List<KeyState>(origKeys.GetEnumerator());
|
||||
while (keys.Count > 1)
|
||||
{
|
||||
keys.PopBack();
|
||||
let keyEntryStr = scope String();
|
||||
KeyState.ToString(keys, keyEntryStr);
|
||||
keyEntryStr.Append(" ");
|
||||
CommandContextToString(keyEntry.mContextFlags, keyEntryStr);
|
||||
|
||||
if (mappedEntries.TryGet(keyEntryStr, var keyPtr, var valuePtr))
|
||||
{
|
||||
let other = valuePtr;
|
||||
other.mHasConflict = true;
|
||||
keyEntry.mHasConflict = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let keyEntryStr in mappedEntries.Keys)
|
||||
delete keyEntryStr;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue