mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 18:59:06 +02:00
SynEdit: fixes for exact scroll range depending on "caret past eol" options. Ensure setting new options takes immediate effect
This commit is contained in:
parent
a236413e40
commit
3ea6f9923c
@ -4819,18 +4819,18 @@ begin
|
|||||||
if not HandleAllocated then // don't know chars in window yet
|
if not HandleAllocated then // don't know chars in window yet
|
||||||
exit(MaxInt);
|
exit(MaxInt);
|
||||||
|
|
||||||
Result := FTheLinesView.LengthOfLongestLine;
|
Result := FTheLinesView.LengthOfLongestLine + 1;
|
||||||
if (eoScrollPastEolAddPage in Options2) then
|
if (eoScrollPastEolAddPage in Options2) then
|
||||||
Result := Result + CharsInWindow - 1;
|
Result := Result + CharsInWindow - 1 - FScreenCaret.ExtraLineChars;
|
||||||
if (eoScrollPastEol in Options) and (Result < fMaxLeftChar) then
|
if (eoScrollPastEol in Options) and (Result < fMaxLeftChar) then
|
||||||
Result := fMaxLeftChar;
|
Result := fMaxLeftChar;
|
||||||
if (eoScrollPastEolAutoCaret in Options2) and (Result < FCaret.CharPos) then
|
if (eoScrollPastEolAutoCaret in Options2) and (Result < FCaret.CharPos) then
|
||||||
Result := FCaret.CharPos;
|
Result := FCaret.CharPos;
|
||||||
|
|
||||||
if AIncludeCharsInWin then
|
if AIncludeCharsInWin then
|
||||||
Result := Result + 1 + FScreenCaret.ExtraLineChars
|
Result := Result + FScreenCaret.ExtraLineChars
|
||||||
else
|
else
|
||||||
Result := Result - CharsInWindow + 1 + FScreenCaret.ExtraLineChars;
|
Result := Result - CharsInWindow + FScreenCaret.ExtraLineChars;
|
||||||
|
|
||||||
if Result < 1 then Result := 1;
|
if Result < 1 then Result := 1;
|
||||||
end;
|
end;
|
||||||
@ -4844,9 +4844,9 @@ begin
|
|||||||
|
|
||||||
Result := FTheLinesView.LengthOfLongestLine + 1;
|
Result := FTheLinesView.LengthOfLongestLine + 1;
|
||||||
if (eoScrollPastEolAddPage in Options2) then
|
if (eoScrollPastEolAddPage in Options2) then
|
||||||
Result := Result + CharsInWindow - 1;
|
Result := Result + CharsInWindow - 1 - FScreenCaret.ExtraLineChars;
|
||||||
if (eoScrollPastEol in Options) and (Result < fMaxLeftChar + 1) then
|
if (eoScrollPastEol in Options) and (Result < fMaxLeftChar + 1) then
|
||||||
Result := fMaxLeftChar + 1;
|
Result := fMaxLeftChar;
|
||||||
|
|
||||||
if Result < 1 then Result := 1;
|
if Result < 1 then Result := 1;
|
||||||
end;
|
end;
|
||||||
@ -8416,9 +8416,13 @@ begin
|
|||||||
FOptions := Value;
|
FOptions := Value;
|
||||||
UpdateOptions;
|
UpdateOptions;
|
||||||
|
|
||||||
if not (eoScrollPastEol in Options) then
|
if eoScrollPastEol in ChangedOptions then begin
|
||||||
|
Include(fStateFlags, sfScrollbarChanged);
|
||||||
LeftChar := LeftChar;
|
LeftChar := LeftChar;
|
||||||
if (eoScrollPastEol in Options) or (eoScrollPastEof in Options) then begin
|
if sfScrollbarChanged in fStateFlags then
|
||||||
|
UpdateScrollbars;
|
||||||
|
end;
|
||||||
|
if (eoScrollPastEof in ChangedOptions) then begin
|
||||||
UpdateScrollBars;
|
UpdateScrollBars;
|
||||||
TopView := TopView;
|
TopView := TopView;
|
||||||
end;
|
end;
|
||||||
@ -8488,6 +8492,12 @@ begin
|
|||||||
UpdateCursor;
|
UpdateCursor;
|
||||||
if (eoPersistentCaretStopBlink in ChangedOptions) then
|
if (eoPersistentCaretStopBlink in ChangedOptions) then
|
||||||
UpdateScreenCaret;
|
UpdateScreenCaret;
|
||||||
|
if ChangedOptions * [eoScrollPastEolAddPage, eoScrollPastEolAutoCaret] <> [] then begin
|
||||||
|
Include(fStateFlags, sfScrollbarChanged);
|
||||||
|
LeftChar := LeftChar;
|
||||||
|
if sfScrollbarChanged in fStateFlags then
|
||||||
|
UpdateScrollbars;
|
||||||
|
end;
|
||||||
StatusChanged([scOptions]);
|
StatusChanged([scOptions]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -589,6 +589,7 @@ begin
|
|||||||
SynEdit.Options := [eoScrollPastEol];
|
SynEdit.Options := [eoScrollPastEol];
|
||||||
|
|
||||||
TestLeftRight('at EOL right', 5, 10, ecRight, 11, 9, 12,10);
|
TestLeftRight('at EOL right', 5, 10, ecRight, 11, 9, 12,10);
|
||||||
|
TestLeftRight('after EOL right', 5, 99, ecRight, 100, 98, 101, 99, False, False);
|
||||||
TestLeftRight('at Max-left right', 5,199, ecRight, 200,198, 200,198, False, False);
|
TestLeftRight('at Max-left right', 5,199, ecRight, 200,198, 200,198, False, False);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user