mirror of https://gitlab.com/basile.b/dexed.git
fix scroll preview on small docs
This commit is contained in:
parent
0670b51d32
commit
35ae9193bc
|
@ -797,6 +797,7 @@ procedure TCEScrollMemo.updateFromSource;
|
||||||
begin
|
begin
|
||||||
fMemo.Font.Assign(fSource.Font);
|
fMemo.Font.Assign(fSource.Font);
|
||||||
fMemo.Lines := fSource.Lines;
|
fMemo.Lines := fSource.Lines;
|
||||||
|
width := fSource.Width div 2;
|
||||||
if fSource.Highlighter.isNotNil then
|
if fSource.Highlighter.isNotNil then
|
||||||
begin
|
begin
|
||||||
fMemo.Color:= fSource.Color;
|
fMemo.Color:= fSource.Color;
|
||||||
|
@ -827,9 +828,12 @@ end;
|
||||||
|
|
||||||
procedure TCEScrollMemo.goToLine(value: integer);
|
procedure TCEScrollMemo.goToLine(value: integer);
|
||||||
begin
|
begin
|
||||||
|
if value > fMemo.Lines.Count then
|
||||||
|
value := fMemo.Lines.Count
|
||||||
|
else if value < 1 then
|
||||||
|
value := 1;
|
||||||
fMemo.CaretY := value;
|
fMemo.CaretY := value;
|
||||||
fMemo.SelectLine(true);
|
fMemo.SelectLine(true);
|
||||||
fMemo.CaretX := 1;
|
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
@ -3134,7 +3138,7 @@ begin
|
||||||
if (x > width - 40) and (x < width - 1) then
|
if (x > width - 40) and (x < width - 1) then
|
||||||
begin;
|
begin;
|
||||||
fScrollMemo.Visible:=true;
|
fScrollMemo.Visible:=true;
|
||||||
fScrollMemo.goToLine((lines.Count div height) * (Y));
|
fScrollMemo.goToLine(trunc((lines.Count / Height) * Y));
|
||||||
fScrollMemo.left := width - 40 - fScrollMemo.Width;
|
fScrollMemo.left := width - 40 - fScrollMemo.Width;
|
||||||
fScrollMemo.Top:= Y - 5;
|
fScrollMemo.Top:= Y - 5;
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue