fix #312 - only first shortcut was rebinded

This commit is contained in:
Basile Burg 2018-04-27 16:09:36 +02:00
parent fa35b1796a
commit 7ba91d8a54
1 changed files with 13 additions and 11 deletions

View File

@ -669,7 +669,7 @@ end;
procedure TCEEditorOptions.applyChangeToEditor(anEditor: TCESynMemo);
var
i, j, k: Integer;
i, j: Integer;
shc: TCEPersistentShortcut;
kst: TSynEditKeyStroke;
dup: boolean;
@ -737,7 +737,13 @@ begin
include(cs, c);
anEditor.closeCompletionChars:=cs;
anEditor.Keystrokes.BeginUpdate;
for i := 0 to anEditor.Keystrokes.Count-1 do
begin
kst := anEditor.Keystrokes.Items[i];
kst.ShortCut:= 0;
kst.ShortCut2:= 0;
end;
for i := 0 to anEditor.Keystrokes.Count-1 do
begin
kst := anEditor.Keystrokes.Items[i];
@ -747,20 +753,16 @@ begin
shc := TCEPersistentShortcut(fShortCuts.Items[j]);
if shc.actionName = EditorCommandToCodeString(kst.Command) then
begin
for k := j + 1 to fShortCuts.Count-1 do
if (TCEPersistentShortcut(fShortCuts.Items[k]).shortcut = shc.shortcut) and
(shc.shortCut <> 0) and (k <> j) then
begin
dup := true;
break;
end;
if not dup then
try
kst.shortCut := shc.shortcut;
except
kst.shortCut := 0;
end;
break;
end;
break;
end;
end;
anEditor.Keystrokes.EndUpdate;
end;
{$ENDREGION}