mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-23 09:29:27 +01:00
* improved paging of help pages so that lines are not missed with 80x25 windows due to lines overflowing the window width
git-svn-id: trunk@30026 -
This commit is contained in:
parent
db7a9950d1
commit
1ecf8dcfa1
@ -96,6 +96,7 @@ uses
|
|||||||
|
|
||||||
const
|
const
|
||||||
page_size = 24;
|
page_size = 24;
|
||||||
|
page_width = 80;
|
||||||
|
|
||||||
var
|
var
|
||||||
option : toption;
|
option : toption;
|
||||||
@ -603,10 +604,12 @@ var
|
|||||||
lastident,
|
lastident,
|
||||||
j,outline,
|
j,outline,
|
||||||
ident,
|
ident,
|
||||||
|
HelpLineHeight,
|
||||||
lines : longint;
|
lines : longint;
|
||||||
show : boolean;
|
show : boolean;
|
||||||
opt : string[32];
|
opt : string[32];
|
||||||
input,
|
input,
|
||||||
|
HelpLine,
|
||||||
s : string;
|
s : string;
|
||||||
p : pchar;
|
p : pchar;
|
||||||
begin
|
begin
|
||||||
@ -730,8 +733,13 @@ begin
|
|||||||
Comment(V_Normal,'');
|
Comment(V_Normal,'');
|
||||||
inc(Lines);
|
inc(Lines);
|
||||||
end;
|
end;
|
||||||
|
HelpLine := PadEnd('',ident)+opt+Copy(s,j+1,255);
|
||||||
|
if HelpLine = '' then
|
||||||
|
HelpLineHeight := 1
|
||||||
|
else
|
||||||
|
HelpLineHeight := Succ (CharLength (HelpLine) div Page_Width);
|
||||||
{ page full ? }
|
{ page full ? }
|
||||||
if (lines >= page_size - 1) then
|
if (lines + HelpLineHeight >= page_size - 1) then
|
||||||
begin
|
begin
|
||||||
if not NoPressEnter then
|
if not NoPressEnter then
|
||||||
begin
|
begin
|
||||||
@ -742,9 +750,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
lines:=0;
|
lines:=0;
|
||||||
end;
|
end;
|
||||||
Comment(V_Normal,PadEnd('',ident)+opt+Copy(s,j+1,255));
|
Comment(V_Normal,HelpLine);
|
||||||
LastIdent:=Ident;
|
LastIdent:=Ident;
|
||||||
inc(Lines);
|
Inc (Lines, HelpLineHeight);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
StopOptions(0);
|
StopOptions(0);
|
||||||
|
|||||||
@ -63,6 +63,8 @@ unit widestr;
|
|||||||
d : pchar; dcp : tstringencoding
|
d : pchar; dcp : tstringencoding
|
||||||
);
|
);
|
||||||
function codepagebyname(const s : string) : tstringencoding;
|
function codepagebyname(const s : string) : tstringencoding;
|
||||||
|
function CharLength (P: PChar; L: SizeInt): SizeInt;
|
||||||
|
function CharLength (const S: string): SizeInt;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -342,4 +344,27 @@ unit widestr;
|
|||||||
Result:=p^.cp;
|
Result:=p^.cp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CharLength (P: PChar; L: SizeInt): SizeInt;
|
||||||
|
var
|
||||||
|
P2: PChar;
|
||||||
|
begin
|
||||||
|
if L = 0 then
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
GetMem (P2, Succ (L));
|
||||||
|
{ Length of the string converted to a SBCS codepage (e.g. ISO 8859-1)
|
||||||
|
should be equal to the amount of characters in the source string. }
|
||||||
|
ChangeCodePage (P, L, DefaultSystemCodepage, P2, 28591);
|
||||||
|
P2 [L] := #0;
|
||||||
|
Result := StrLen (P2);
|
||||||
|
FreeMem (P2, Succ (L));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CharLength (const S: string): SizeInt;
|
||||||
|
begin
|
||||||
|
Result := CharLength (@S [1], Length (S));
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user