From 7ba91d8a54605064b6511b3c8fbe993a16a666d3 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Fri, 27 Apr 2018 16:09:36 +0200 Subject: [PATCH] fix #312 - only first shortcut was rebinded --- src/ce_editoroptions.pas | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/ce_editoroptions.pas b/src/ce_editoroptions.pas index c5a3ddc6..4c555fc3 100644 --- a/src/ce_editoroptions.pas +++ b/src/ce_editoroptions.pas @@ -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}