Browse Source

+ optimization: use EgcWidth instead of StrWidth wherever possible

git-svn-id: branches/unicodekvm@48813 -
nickysn 4 years ago
parent
commit
1b1facf879
2 changed files with 5 additions and 5 deletions
  1. 4 4
      packages/fv/src/dialogs.inc
  2. 1 1
      packages/fv/src/views.inc

+ 4 - 4
packages/fv/src/dialogs.inc

@@ -1480,7 +1480,7 @@ BEGIN
         Dec(SkipToFirstPosLeft, Length(EGC))
         Dec(SkipToFirstPosLeft, Length(EGC))
       else
       else
         begin
         begin
-          EGC_StrWidth := StrWidth(EGC);
+          EGC_StrWidth := EgcWidth(EGC);
           if (ScrPos + EGC_StrWidth - 1) > (Size.X - 2) then
           if (ScrPos + EGC_StrWidth - 1) > (Size.X - 2) then
             break;
             break;
           with B[ScrPos] do
           with B[ScrPos] do
@@ -1678,7 +1678,7 @@ Delta, Anchor, OldCurPos, OldFirstPos, OldSelStart, OldSelEnd: Sw_Integer;
            Dec(Skip, Length(EGC))
            Dec(Skip, Length(EGC))
          else
          else
            begin
            begin
-             Dec(Mouse.X, StrWidth(EGC));
+             Dec(Mouse.X, EgcWidth(EGC));
              if Mouse.X <= 0 then
              if Mouse.X <= 0 then
                break;
                break;
              Inc(Pos, Length(EGC));
              Inc(Pos, Length(EGC));
@@ -1961,7 +1961,7 @@ BEGIN
            exit;
            exit;
          end;
          end;
        Inc(StrPos, Length(EGC));
        Inc(StrPos, Length(EGC));
-       Inc(ScrPos, StrWidth(EGC));
+       Inc(ScrPos, EgcWidth(EGC));
      end;
      end;
    Result := CurPos - Length(Data) + ScrPos;
    Result := CurPos - Length(Data) + ScrPos;
 END;
 END;
@@ -3185,7 +3185,7 @@ BEGIN
              LastWordBoundaryWidth := CurLineWidth;
              LastWordBoundaryWidth := CurLineWidth;
            end;
            end;
            CurLine := CurLine + EGC;
            CurLine := CurLine + EGC;
-           Inc(CurLineWidth, StrWidth(EGC));
+           Inc(CurLineWidth, EgcWidth(EGC));
            if CurLineWidth <= Size.X then
            if CurLineWidth <= Size.X then
            begin
            begin
              LastTruncatedBoundaryLen := Length(CurLine);
              LastTruncatedBoundaryLen := Length(CurLine);

+ 1 - 1
packages/fv/src/views.inc

@@ -4533,7 +4533,7 @@ begin
              Attribute:=MyColor;
              Attribute:=MyColor;
              ExtendedGraphemeCluster:=EGC;
              ExtendedGraphemeCluster:=EGC;
            end;
            end;
-         Inc(i, StrWidth(EGC));
+         Inc(i, EgcWidth(EGC));
        end;
        end;
 {$else FV_UNICODE}
 {$else FV_UNICODE}
      MyColor:=MyColor shl 8;
      MyColor:=MyColor shl 8;