mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 22:19:17 +02:00
SynEdit: add option eoNoScrollOnSelectRange, to prevent scroll on select all/paragraph/to-brace // Fix select-to-brace to scroll by default.
git-svn-id: trunk@62181 -
This commit is contained in:
parent
546b5cedd7
commit
97e5dde402
@ -219,6 +219,7 @@ type
|
||||
TSynStateFlag = (sfCaretChanged, sfHideCursor,
|
||||
sfEnsureCursorPos, sfEnsureCursorPosAtResize,
|
||||
sfExplicitTopLine, sfExplicitLeftChar, // when doing EnsureCursorPos keep top/Left, if they where set explicitly after the caret (only applies before handle creation)
|
||||
sfPreventScrollAfterSelect,
|
||||
sfIgnoreNextChar, sfPainting, sfHasPainted, sfHasScrolled,
|
||||
sfScrollbarChanged, sfHorizScrollbarVisible, sfVertScrollbarVisible,
|
||||
sfAfterLoadFromFileNeeded,
|
||||
@ -286,7 +287,8 @@ type
|
||||
eoOverwriteBlock, // Allows to overwrite currently selected block, when pasting or typing new text
|
||||
eoAutoHideCursor, // Hide mouse cursor, when new text is typed
|
||||
eoColorSelectionTillEol, // Colorize selection background only till EOL of each line, not till edge of control
|
||||
eoPersistentCaretStopBlink // only if eoPersistentCaret > do not blink, draw fixed line
|
||||
eoPersistentCaretStopBlink,// only if eoPersistentCaret > do not blink, draw fixed line
|
||||
eoNoScrollOnSelectRange // SelectALl, SelectParagraph, SelectToBrace will not scroll
|
||||
);
|
||||
TSynEditorOptions2 = set of TSynEditorOption2;
|
||||
|
||||
@ -4434,6 +4436,8 @@ begin
|
||||
LastPt.y := 1;
|
||||
SetCaretAndSelection(LogicalToPhysicalPos(LastPt), Point(1, 1), LastPt);
|
||||
FBlockSelection.ActiveSelectionMode := smNormal;
|
||||
if eoNoScrollOnSelectRange in FOptions2 then
|
||||
Include(fStateFlags, sfPreventScrollAfterSelect);
|
||||
DoDecPaintLock(Self);
|
||||
end;
|
||||
|
||||
@ -4446,7 +4450,11 @@ end;
|
||||
|
||||
procedure TCustomSynEdit.SelectToBrace;
|
||||
begin
|
||||
DoIncPaintLock(Self); // No editing is taking place
|
||||
FindMatchingBracket(CaretXY,true,true,true,false);
|
||||
if eoNoScrollOnSelectRange in FOptions2 then
|
||||
Include(fStateFlags, sfPreventScrollAfterSelect);
|
||||
DoDecPaintLock(Self);
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.SelectWord;
|
||||
@ -5481,6 +5489,8 @@ begin
|
||||
FBlockSelection.ActiveSelectionMode := smNormal;
|
||||
CaretXY := FBlockSelection.EndLineBytePos;
|
||||
//DebugLn(' FFF3 ',Value.X,',',Value.Y,' BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y);
|
||||
if eoNoScrollOnSelectRange in FOptions2 then
|
||||
Include(fStateFlags, sfPreventScrollAfterSelect);
|
||||
DoDecPaintLock(Self);
|
||||
end;
|
||||
|
||||
@ -6517,6 +6527,7 @@ begin
|
||||
MaxX:=Min(PhysBlockEndXY.X,MinX+CharsInWindow-1);
|
||||
end;
|
||||
end;
|
||||
if not (sfPreventScrollAfterSelect in fStateFlags) then begin
|
||||
if not (sfExplicitLeftChar in fStateFlags) then begin
|
||||
{DebugLn('TCustomSynEdit.EnsureCursorPosVisible A CaretX=',dbgs(PhysCaretXY.X),
|
||||
' BlockX=',dbgs(PhysBlockBeginXY.X)+'-'+dbgs(PhysBlockEndXY.X),
|
||||
@ -6539,6 +6550,8 @@ begin
|
||||
else
|
||||
TopView := TopView; //mh 2000-10-19
|
||||
end;
|
||||
end;
|
||||
Exclude(fStateFlags, sfPreventScrollAfterSelect);
|
||||
finally
|
||||
DoDecPaintLock(Self);
|
||||
//{BUG21996} DebugLnExit(['TCustomSynEdit.EnsureCursorPosVisible Caret=',dbgs(CaretXY),', BlockBegin=',dbgs(BlockBegin),' BlockEnd=',dbgs(BlockEnd), ' StateFlags=',dbgs(fStateFlags), ' paintlock', FPaintLock]);
|
||||
|
Loading…
Reference in New Issue
Block a user