fix, mess between options and custom commands

This commit is contained in:
Basile Burg 2016-02-03 20:55:56 +01:00
parent f234067fc3
commit 9bce6dad73
1 changed files with 5 additions and 4 deletions

View File

@ -771,6 +771,7 @@ var
beg: string; beg: string;
i: integer = 1; i: integer = 1;
j: integer; j: integer;
opts: TSynEditorOptions;
const const
blk = [' ', #9]; blk = [' ', #9];
begin begin
@ -785,19 +786,19 @@ begin
i += 1; i += 1;
end; end;
i -= 1; i -= 1;
opts := editor.Options;
editor.BeginUndoBlock; editor.BeginUndoBlock;
editor.CommandProcessor(ecInsertLine, '', nil); editor.CommandProcessor(ecInsertLine, '', nil);
editor.CommandProcessor(ecDown, '', nil); editor.CommandProcessor(ecDown, '', nil);
editor.CommandProcessor(ecInsertLine, '', nil); editor.CommandProcessor(ecInsertLine, '', nil);
editor.CommandProcessor(ecDown, '', nil); editor.CommandProcessor(ecDown, '', nil);
if not (eoAutoIndent in editor.Options) then for j := 1 to i do editor.CommandProcessor(ecChar, beg[j], nil);
for j := 1 to i do editor.CommandProcessor(ecChar, beg[j], nil);
editor.CommandProcessor(ecChar, '}', nil); editor.CommandProcessor(ecChar, '}', nil);
editor.CommandProcessor(ecUp, '', nil); editor.CommandProcessor(ecUp, '', nil);
for j := 1 to i do editor.CommandProcessor(ecChar, beg[j], nil); for j := 1 to i do editor.CommandProcessor(ecChar, beg[j], nil);
if not (eoAutoIndent in editor.Options) then editor.CommandProcessor(ecTab, '', nil);
editor.CommandProcessor(ecTab, '', nil);
editor.EndUndoBlock; editor.EndUndoBlock;
editor.Options := opts;
end; end;
procedure commentSelection(editor: TSynEdit); procedure commentSelection(editor: TSynEdit);