Screen width more than 255 chars (for Unixes at least)

This commit is contained in:
Margers 2025-01-09 21:21:09 +00:00 committed by Michael Van Canneyt
parent 30dcf0b61a
commit 4e96751cb7
9 changed files with 46 additions and 26 deletions

View File

@ -744,7 +744,7 @@ BEGIN
State := sfVisible + sfSelected + sfFocused +
sfModal + sfExposed; { Deafult states }
Options := 0; { No options set }
Size.X := ScreenWidth; { Set x size value }
Size.X := Min(ScreenWidth,MaxViewWidth); { Set x size value }
Size.Y := ScreenHeight; { Set y size value }
InitStatusLine; { Create status line }
InitMenuBar; { Create a bar menu }

View File

@ -719,8 +719,8 @@ CONST
VAR
MouseIntFlag: Byte; { Mouse in int flag }
MouseButtons: Byte; { Mouse button state }
ScreenWidth : Byte; { Screen text width }
ScreenHeight: Byte; { Screen text height }
ScreenWidth : Sw_Word; { Screen text width }
ScreenHeight: Sw_Word; { Screen text height }
ScreenMode : TVideoMode; { Screen mode }
MouseWhere : TPoint; { Mouse position }
@ -753,11 +753,6 @@ CONST EventQSize = 16; { Default int bufsize }
{---------------------------------------------------------------------------}
CONST QueueMax = 64; { Max new queue size }
{---------------------------------------------------------------------------}
{ MAX WIEW WIDTH to avoid TDrawBuffer overrun in views unit }
{---------------------------------------------------------------------------}
CONST MaxViewWidth = 255; { Max view width }
{***************************************************************************}
{ PRIVATE INTERNAL TYPES }
{***************************************************************************}
@ -1611,9 +1606,6 @@ begin
{$IFDEF FPC_DOTTEDUNITS}System.Console.{$ENDIF}Video.SetVideoMode(StoreScreenMode);
GetVideoMode(ScreenMode);
end;
if ScreenWidth > MaxViewWidth then
ScreenWidth := MaxViewWidth;
ScreenWidth:={$IFDEF FPC_DOTTEDUNITS}System.Console.{$ENDIF}Video.ScreenWidth;
ScreenHeight:={$IFDEF FPC_DOTTEDUNITS}System.Console.{$ENDIF}Video.ScreenHeight;
VideoInitialized:=true;

View File

@ -349,7 +349,8 @@ var c_normal,c_normal_x,c_select,c_focus:byte;
function draw_item(cur:pointer;level,position:sw_integer;
lines:longint;flags:word):boolean;
var c,i:byte;
var c:byte;
i:sw_integer;
{$ifdef FV_UNICODE}
s,t:UnicodeString;
{$else FV_UNICODE}

View File

@ -281,8 +281,15 @@ CONST
{---------------------------------------------------------------------------}
CONST
wnNoNumber = 0; { Window has no num }
{$ifdef unix}
MaxViewWidth = 1024; { Max view width }
{$else}
{$ifdef windows}
MaxViewWidth = 255; { Max view width }
{$else}
MaxViewWidth = 255; { Max view width }
{$endif}
{$endif}
{***************************************************************************}
{ PUBLIC TYPE DEFINITIONS }
@ -1829,6 +1836,8 @@ begin
Origin := Bounds.A; { Get first corner }
Size := Bounds.B; { Get second corner }
Dec(Size.X,Origin.X);
{ in case MaxViewWidth is smaller than ScreenWidth }
Size.X:=Min(Size.X,MaxViewWidth); { adjust to be in bounds of TDrawBuffer }
Dec(Size.Y,Origin.Y);
end;
@ -4397,7 +4406,9 @@ begin
G:=p^.Owner;
if (G^.buffer<>Nil) then
begin
BufPos:=G^.size.x * staticVar2.y + x1;
{ find view position on global screen, }
{ use ScreenWidth for that }
BufPos:={G^.size.x} ScreenWidth * staticVar2.y + x1;
SrcPos:=x1 - staticVar2.offset;
l:=x2-x1;
if (shadowCounter=0) then

View File

@ -74,9 +74,11 @@ uses Objects,Views,App,MsgBox,
const
MaxStatusLevel = 10;
{$if MaxViewWidth < 256}
var StatusStack : array[0..MaxStatusLevel] of string[MaxViewWidth];
{$else}
var StatusStack : array[0..MaxStatusLevel] of string[255{MaxViewWidth}];
{$endif}
const
StatusStackPtr : integer = 0;

View File

@ -1497,7 +1497,7 @@ end;
procedure TIDEApp.ShowIDEScreen;
var oldH,oldW : byte;
var oldH,oldW : Sw_Word;
begin
if Assigned(UserScreen) then
UserScreen^.SaveConsoleScreen;

View File

@ -154,7 +154,11 @@ type
{$endif WITH_CRT}
const
{$if defined(unix) or defined(windows)}
MaxVideoLine = 65520 div ({2*}255); { maximum number of lines (don't have to fit in 64K) }
{$else}
MaxVideoLine = 65520 div (2*MaxViewWidth); { maximum number of lines that fit in 64K }
{$endif}
type
TAnsiBuffer = array[0..MaxViewWidth*MaxVideoLine] of word;
@ -687,7 +691,7 @@ begin
end;
procedure TANSIViewConsole.ClrScr;
var X,Y: word;
var X,Y: sw_word;
Pos: longint;
begin
GotoXY(1,1);
@ -700,7 +704,7 @@ begin
end;
procedure TANSIViewConsole.ClrEol;
var X,Y: word;
var X,Y: sw_word;
Pos: longint;
begin
if Owner<>nil then
@ -765,7 +769,7 @@ begin
end;
procedure TANSIViewConsole.GotoXY(X,Y: integer);
var W: word;
var W: sw_word;
begin
if Owner<>nil then
while Y>MaxVideoLine do
@ -904,7 +908,7 @@ begin
end;
procedure TANSIBackgroundConsole.ClrScr;
var X,Y: word;
var X,Y: sw_word;
Pos: longint;
begin
GotoXY(1,1);
@ -918,7 +922,7 @@ begin
end;
procedure TANSIBackgroundConsole.ClrEol;
var X,Y: word;
var X,Y: sw_word;
Pos: longint;
begin
if Owner<>nil then
@ -975,7 +979,7 @@ begin
end;
procedure TANSIBackgroundConsole.GotoXY(X,Y: integer);
var W: word;
var W: sw_word;
begin
if Owner<>nil then
while Y>MaxVideoLine do

View File

@ -4064,7 +4064,11 @@ var SelectColor,
Color: word;
ColorTab: array[coFirstColor..coLastColor] of word;
ErrorLine: integer;
{$if MaxViewWidth < 256}
ErrorMsg: string[MaxViewWidth];
{$else}
ErrorMsg: string[255];
{$endif}
function CombineColors(Orig,Modifier: byte): byte;
var Color: byte;
begin
@ -4232,7 +4236,7 @@ begin
FreeFormat[X]:=false;
end;
{ redundant check, for loop condition is taking care of correct range
{ redundant check, for loop condition is taking care of coorect range
if (0<=LSX+X-1-Delta.X) and (LSX+X-1-Delta.X<MaxViewWidth) then }
MoveChar(B[LSX+X-1-Delta.X],C,Color,1);
end; { for X:=1 to ... }

View File

@ -646,11 +646,17 @@ var
end;
procedure OutSpaces;
var SpaceLen : longint;
begin
if (Spaces=0) then
exit;
OutClr(SpaceFg,SpaceBg,SpaceAttr);
OutData(Space(Spaces));
repeat
SpaceLen:=Spaces;
if SpaceLen > 200 then SpaceLen:=200; {have to fit in ShortString}
OutData(Space(SpaceLen));
Spaces:=Spaces-SpaceLen;
until Spaces = 0;
LastX:=x;
LastY:=y;
Spaces:=0;