mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 14:56:20 +02:00
SynEdit: Linenumber gutter, "Every Nth Line" must be 1 or greater. Issue #39394
This commit is contained in:
parent
059c77a655
commit
9cf535759e
@ -142,7 +142,7 @@ procedure TSynGutterLineNumber.SetShowOnlyLineNumbersMultiplesOf(const AValue :
|
|||||||
begin
|
begin
|
||||||
If FShowOnlyLineNumbersMultiplesOf <> AValue then
|
If FShowOnlyLineNumbersMultiplesOf <> AValue then
|
||||||
begin
|
begin
|
||||||
FShowOnlyLineNumbersMultiplesOf := AValue;
|
FShowOnlyLineNumbersMultiplesOf := Max(AValue, 1);
|
||||||
DoChange(self);
|
DoChange(self);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -236,7 +236,7 @@ var
|
|||||||
s: string;
|
s: string;
|
||||||
dc: HDC;
|
dc: HDC;
|
||||||
LineInfo: TSynEditGutterLineInfo;
|
LineInfo: TSynEditGutterLineInfo;
|
||||||
LineHeight: Integer;
|
LineHeight, EveryNLine: Integer;
|
||||||
t: TLinePos;
|
t: TLinePos;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -269,6 +269,7 @@ begin
|
|||||||
// prepare the rect initially
|
// prepare the rect initially
|
||||||
rcLine := AClip;
|
rcLine := AClip;
|
||||||
rcLine.Bottom := AClip.Top;
|
rcLine.Bottom := AClip.Top;
|
||||||
|
EveryNLine := Max(ShowOnlyLineNumbersMultiplesOf, 1);
|
||||||
for i := t + FirstLine to t + LastLine do
|
for i := t + FirstLine to t + LastLine do
|
||||||
begin
|
begin
|
||||||
iLine := ToPos(ViewedTextBuffer.DisplayView.ViewToTextIndexEx(i, LineInfo.LineRange));
|
iLine := ToPos(ViewedTextBuffer.DisplayView.ViewToTextIndexEx(i, LineInfo.LineRange));
|
||||||
@ -278,7 +279,7 @@ begin
|
|||||||
// Must show a dot instead of line number if
|
// Must show a dot instead of line number if
|
||||||
// line number is not the first, the last, the current line
|
// line number is not the first, the last, the current line
|
||||||
// or a multiple of ShowOnlyLineNumbersMultiplesOf
|
// or a multiple of ShowOnlyLineNumbersMultiplesOf
|
||||||
LineInfo.ShowDot := ((iLine mod ShowOnlyLineNumbersMultiplesOf) <> 0)
|
LineInfo.ShowDot := ((iLine mod EveryNLine) <> 0)
|
||||||
and (iLine <> SynEdit.CaretY) and (iLine <> 1)
|
and (iLine <> SynEdit.CaretY) and (iLine <> 1)
|
||||||
and (iLine <> SynEdit.Lines.Count);
|
and (iLine <> SynEdit.Lines.Count);
|
||||||
// Get the formatted line number or dot
|
// Get the formatted line number or dot
|
||||||
|
Loading…
Reference in New Issue
Block a user