+ some fv unicode fixes for supporting complex (multi-char) enhanced grapheme clusters

git-svn-id: branches/unicodekvm@48731 -
This commit is contained in:
nickysn 2021-02-20 04:03:15 +00:00
parent 545dd0353b
commit 89c7ae42af
6 changed files with 34 additions and 16 deletions

View File

@ -42,6 +42,15 @@
<OtherUnitFiles Value="../src;../../rtl-console/src/unix;../../rtl-extra/src/inc;../../rtl-unicode/src/inc"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
<VerifyObjMethodCallValidity Value="True"/>
</CodeGeneration>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">

View File

@ -3,7 +3,7 @@ program testuapp;
{$codepage UTF8}
uses
Objects, UDrivers, UViews, UMenus, UApp;
Objects, UDrivers, UViews, UMenus, UApp, SysUtils;
const
cmOrderNew = 200;
@ -40,7 +40,7 @@ begin
R.A.Y := R.B.Y - 1;
new(StatusLine, Init(R,
NewStatusDef(0, $EFFF,
NewStatusKey('~F1~ 打开', kbF1, cmHelp,
NewStatusKey({'~F1~ 打开'}'F1 По п' + 'ъ́' + 'тя', kbF1, cmHelp,
NewStatusKey('~F3~ Отваряне', kbF3, cmOpen,
NewStatusKey('~F4~ Νέος', kbF4, cmNew,
NewStatusKey('~Alt+F3~ Zavřít', kbAltF3, cmClose,

View File

@ -1590,7 +1590,7 @@ BEGIN
{$endif FV_UNICODE}
Inc(I, 2); { Move along }
MoveStr(B[I], HintBuf, Byte(CNormal)); { Move hint to buffer }
I := I + Length(HintBuf); { Hint length }
I := I + StrWidth(HintBuf); { Hint length }
End;
WriteLine(0, 0, Size.X, 1, B); { Write the buffer }
END;

View File

@ -60,7 +60,7 @@ USES
Os2Def, DosCalls, PmWin,
{$ENDIF}
Objects, {$ifdef FV_UNICODE}UFVCommon,UDrivers{$else}FVCommon,Drivers{$endif}, fvconsts, { GFV standard units }
Objects, {$ifdef FV_UNICODE}UFVCommon,UDrivers,GraphemeBreakProperty{$else}FVCommon,Drivers{$endif}, fvconsts, { GFV standard units }
Video;
@ -4525,23 +4525,30 @@ end;
procedure TView.WriteStr(X, Y: Sw_Integer; Str: Sw_String; Color: Byte);
var
{$ifdef FV_UNICODE}
EGC: Sw_String;
{$endif FV_UNICODE}
l,i : Sw_word;
B : TDrawBuffer;
myColor : word;
begin
l:=length(Str);
l:=StrWidth(Str);
if l>0 then
begin
if l>maxViewWidth then
l:=maxViewWidth;
MyColor:=MapColor(Color);
{$ifdef FV_UNICODE}
for i:=0 to l-1 do
with B[i] do
begin
Attribute:=MyColor;
ExtendedGraphemeCluster:=Str[i+1];
end;
i:=0;
for EGC in TUnicodeStringExtendedGraphemeClustersEnumerator.Create(Str) do
begin
with B[i] do
begin
Attribute:=MyColor;
ExtendedGraphemeCluster:=EGC;
end;
Inc(i, StrWidth(EGC));
end;
{$else FV_UNICODE}
MyColor:=MyColor shl 8;
for i:=0 to l-1 do

View File

@ -80,7 +80,7 @@ end;
class operator TEnhancedVideoCell.Copy(constref aSrc: TEnhancedVideoCell; var aDst: TEnhancedVideoCell);
begin
aDst.ExtendedGraphemeCluster := aSrc.ExtendedGraphemeCluster;
aDst.FAttributes := aSrc.FAttributes;
aDst.Attribute := aSrc.Attribute;
end;
Const

View File

@ -514,8 +514,8 @@ var
LastX,LastY,
SpaceAttr,
LastAttr : longint;
p,pold : penhancedvideocell;
LastLineWidth : Longint;
p,pold : penhancedvideocell;
function transform_cp437_to_iso01(const st:string):string;
@ -667,7 +667,9 @@ var
Begin
while (eol>0) do
begin
hstr:=#13#10+hstr;
outbuf[outptr]:=#13;
outbuf[outptr+1]:=#10;
inc(outptr,2);
dec(eol);
end;
{ if (convert=cv_vga_to_acs) and (ACSIn<>'') and (ACSOut<>'') then
@ -797,7 +799,7 @@ begin
LastX:=x+1;
LastY:=y;
end;
p^:=chattr;
//p^:=chattr;
end;
inc(p);
inc(pold);
@ -811,7 +813,7 @@ begin
end;
eol:=0;
{if am in capabilities? Then}
if (Console=ttyFreeBSD) and (Plongint(p)^<>plongint(pold)^) Then
if (Console=ttyFreeBSD) and (p^<>pold^) Then
begin
OutData(XY2Ansi(ScreenWidth,ScreenHeight,LastX,LastY));
OutData(#8);