[Settings][KBM]Don't clear data with numpad chord (#31715)

This commit is contained in:
Jaime Bernardo
2024-03-06 12:22:39 +00:00
committed by GitHub
parent b4be3994dc
commit afcd551ccc

View File

@@ -26,7 +26,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public string OriginalKeys { get; set; } public string OriginalKeys { get; set; }
[JsonPropertyName("secondKeyOfChord")] [JsonPropertyName("secondKeyOfChord")]
public int SecondKeyOfChord { get; set; } public uint SecondKeyOfChord { get; set; }
[JsonPropertyName("newRemapKeys")] [JsonPropertyName("newRemapKeys")]
public string NewRemapKeys { get; set; } public string NewRemapKeys { get; set; }
@@ -129,7 +129,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
NativeMethods.SetForegroundWindow(handle); NativeMethods.SetForegroundWindow(handle);
} }
private static List<string> MapKeysOnlyChord(int secondKeyOfChord) private static List<string> MapKeysOnlyChord(uint secondKeyOfChord)
{ {
var result = new List<string>(); var result = new List<string>();
if (secondKeyOfChord <= 0) if (secondKeyOfChord <= 0)
@@ -137,12 +137,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library
return result; return result;
} }
result.Add(Helper.GetKeyName((uint)secondKeyOfChord)); result.Add(Helper.GetKeyName(secondKeyOfChord));
return result; return result;
} }
private static List<string> MapKeys(string stringOfKeys, int secondKeyOfChord, bool splitChordsWithComma = false) private static List<string> MapKeys(string stringOfKeys, uint secondKeyOfChord, bool splitChordsWithComma = false)
{ {
if (stringOfKeys == null) if (stringOfKeys == null)
{ {
@@ -192,7 +192,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
} }
else else
{ {
return MapKeys(OriginalKeys, -1, splitChordsWithComma); return MapKeys(OriginalKeys, 0, splitChordsWithComma);
} }
} }