Move form sizing to after Show so font metrics are fully realized
Sizing the form in the constructor via HandleNeeded was unreliable -- RecalcCellSize runs again during Show with different font metrics, shrinking FAnsi while the form keeps its stale size. Move the ClientWidth/ClientHeight assignment into Run after Show, when handles are fully created and RecalcCellSize has settled. Restore constructor Width/Height defaults in TKPAnsi for reasonable pre-handle dimensions. Remove CP437 box-drawing diagnostic from the terminal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3c5b57c6b5
commit
d898e73213
2 changed files with 8 additions and 12 deletions
|
|
@ -318,6 +318,8 @@ var
|
|||
Line: PTermLine;
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
Width := 660;
|
||||
Height := 450;
|
||||
Color := clBlack;
|
||||
TabStop := True;
|
||||
FCols := 80;
|
||||
|
|
|
|||
|
|
@ -151,18 +151,6 @@ begin
|
|||
FAnsi.Top := 38;
|
||||
FAnsi.OnKeyData := AnsiKeyData;
|
||||
|
||||
{ Size form to fit terminal + toolbar }
|
||||
ClientWidth := FAnsi.Width;
|
||||
ClientHeight := FAnsi.Top + FAnsi.Height;
|
||||
|
||||
{ Font diagnostic: write known CP437 box-drawing characters. }
|
||||
{ If the OEM font is working, you should see: }
|
||||
{ Line 1: single-line box top +---+ }
|
||||
{ Line 2: shade + full block ░▒▓█ }
|
||||
{ Line 3: single-line box bottom +---+ }
|
||||
{ If you see accented letters, the font is ANSI_CHARSET instead of }
|
||||
{ OEM_CHARSET. }
|
||||
FAnsi.Write(#$DA#$C4#$C4#$C4#$BF' '#$B0#$B1#$B2#$DB' '#$C0#$C4#$C4#$C4#$D9#13#10);
|
||||
end;
|
||||
|
||||
|
||||
|
|
@ -176,6 +164,12 @@ var
|
|||
HasData: Boolean;
|
||||
begin
|
||||
Show;
|
||||
|
||||
{ Size form to fit terminal + toolbar. Show triggers handle creation }
|
||||
{ and RecalcCellSize, so FAnsi.Width/Height reflect measured font. }
|
||||
ClientWidth := FAnsi.Width;
|
||||
ClientHeight := FAnsi.Top + FAnsi.Height;
|
||||
|
||||
FDone := False;
|
||||
while not FDone do
|
||||
begin
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue