mirror of https://gitlab.com/basile.b/dexed.git
editor, add the ecScrollCenteredDown and ecScrollCenteredUp actions
This commit is contained in:
parent
5966e03425
commit
0c5b0b101e
|
@ -3,6 +3,9 @@
|
|||
## Enhancements
|
||||
|
||||
- Editor, added the _Redo All_ action.
|
||||
- Editor, added the _ecScrollCenteredDown_ and _ecScrollCenteredUp_ actions. Only available using shortcuts and
|
||||
binded by default to <kbd>UP/DOWN</kbd>+<kbd>CTRL</kbd>+<kbd>ALT</kbd>, they allow to maintain the caret at the center
|
||||
of the text view while scrolling.
|
||||
|
||||
## Bugs fixed
|
||||
|
||||
|
|
|
@ -382,6 +382,7 @@ type
|
|||
procedure setDscannerOptions(dsEnabled: boolean; dsDelay: integer);
|
||||
procedure centerCursor();
|
||||
procedure redoAll();
|
||||
procedure scrollCentered(down: boolean);
|
||||
//
|
||||
property IdentifierMatchOptions: TIdentifierMatchOptions read fMatchOpts write setMatchOpts;
|
||||
property Identifier: string read fIdentifier;
|
||||
|
@ -483,6 +484,8 @@ const
|
|||
ecSelLeftWordEdge = ecUserFirst + 32;
|
||||
ecSelRightWordEdge = ecUserFirst + 33;
|
||||
ecRedoAll = ecUserFirst + 34;
|
||||
ecScrollCenteredUp = ecUserFirst + 35;
|
||||
ecScrollCenteredDown = ecUserFirst + 36;
|
||||
var
|
||||
D2Syn: TSynD2Syn; // used as model to set the options when no editor exists.
|
||||
TxtSyn: TSynTxtSyn; // used as model to set the options when no editor exists.
|
||||
|
@ -1484,6 +1487,8 @@ begin
|
|||
AddKey(ecSmartWordLeft, 0, [], 0, []);
|
||||
AddKey(ecSmartWordRight, 0, [], 0, []);
|
||||
AddKey(ecRedoAll, 0, [], 0, []);
|
||||
AddKey(ecScrollCenteredDown, VK_DOWN, [ssCtrl, ssAlt], 0, []);
|
||||
AddKey(ecScrollCenteredUp, VK_UP, [ssCtrl, ssAlt], 0, []);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1524,6 +1529,8 @@ begin
|
|||
'ecSelLeftWordEdge': begin Int := ecSelLeftWordEdge; exit(true); end;
|
||||
'ecSelRightWordEdge': begin Int := ecSelRightWordEdge; exit(true); end;
|
||||
'ecRedoAll': begin Int := ecRedoAll; exit(true); end;
|
||||
'ecScrollCenteredUp': begin Int := ecScrollCenteredUp; exit(true); end;
|
||||
'ecScrollCenteredDown': begin Int := ecScrollCenteredDown; exit(true); end;
|
||||
else exit(false);
|
||||
end;
|
||||
end;
|
||||
|
@ -1565,6 +1572,8 @@ begin
|
|||
ecSelLeftWordEdge: begin Ident := 'ecSelLeftWordEdge'; exit(true); end;
|
||||
ecSelRightWordEdge: begin Ident := 'ecSelRightWordEdge'; exit(true); end;
|
||||
ecRedoAll: begin Ident := 'ecRedoAll'; exit(true); end;
|
||||
ecScrollCenteredUp: begin Ident := 'ecScrollCenteredUp'; exit(true); end;
|
||||
ecScrollCenteredDown: begin Ident := 'ecScrollCenteredDown'; exit(true); end;
|
||||
else exit(false);
|
||||
end;
|
||||
end;
|
||||
|
@ -1699,6 +1708,10 @@ begin
|
|||
gotoWordEdge(true);
|
||||
ecRedoAll:
|
||||
redoAll();
|
||||
ecScrollCenteredUp:
|
||||
scrollCentered(false);
|
||||
ecScrollCenteredDown:
|
||||
scrollCentered(true);
|
||||
end;
|
||||
if fOverrideColMode and not SelAvail then
|
||||
begin
|
||||
|
@ -2135,6 +2148,20 @@ begin
|
|||
TopView := NewTopLine;
|
||||
end;
|
||||
|
||||
procedure TDexedMemo.scrollCentered(down: boolean);
|
||||
begin
|
||||
centerCursor();
|
||||
if down then
|
||||
begin
|
||||
ExecuteCommand(ecScrollDown, #0, nil);
|
||||
CaretY := CaretY - 1;
|
||||
end else
|
||||
begin
|
||||
ExecuteCommand(ecScrollUp, #0, nil);
|
||||
CaretY := CaretY + 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDexedMemo.ShowPhobosDoc;
|
||||
var
|
||||
str: string;
|
||||
|
|
Loading…
Reference in New Issue