⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 awterm.pas

📁 测试用例
💻 PAS
📖 第 1 页 / 共 5 页
字号:
            end else begin
              bfColor := FColor;
              bbColor := BColor;
            end;
          end;
        eString :
          {AProBCB version only has the Byte version of this array.}
          {$IFDEF AProBCB}
          for I := 1 to OtherStrLen do
          	  bWriteChar(Char(OtherStr[I]));
          {$ELSE}
          for I := 1 to Length(OtherStr) do
            bWriteChar(OtherStr[I]);
          {$ENDIF}
        eCUP : {eGotoXY, eHVP} {etVT52, etANSI, etVT100}
          begin
            if Integer(X) > 0 then
              bX := bXPos + (X-1);
            if Integer(Y) > 0 then
              bY := bYPos + (Y-1);

            {Limit checks...}
            if bX >= bWidth then
              bX := bWidth-1
            else if Integer(bX) < 0 then
              bX := 0;
            if bY >= bHeight then
              bY := bHeight-1
            else if integer(bY) < 0 then
              bY := 0;

            {Update the caret position}
            bMoveCaret;

            {margin check}
            if (((bY-bYPos)+1) >= cMarginTop) and
               (((bY-bYPos)+1) <= cMarginBottom) then
              bInMargins := True
            else
              bInMargins := False;
          end;
        eCUU : {eUp, eRI} {etVT52, etANSI, etVT100}
          begin
            {margin check}
            if ((((bY-bYPos)+1) >= cMarginTop) and
               (((bY-bYPos)+1) <= cMarginBottom))
               or
               {will cursor 'pass through' margin}
               ((((bY-bYPos)+1-Y) < cMarginTop) and
               (((bY-bYPos)+1) > cMarginTop)) then
              bInMargins := True
            else
              bInMargins := False;

            if Y > bY then
              Y := bY;
            Dec(bY, Y);

            {check if in a scrolling area and limit top}
            if bInMargins and (((bY-bYPos)+1) <= cMarginTop) then
              bY := (bYPos+cMarginTop)-1

            {limit check for top of client}
            else if integer(bY) < bYPos then
              bY := bYPos;

            {Update the caret position}
            bMoveCaret;
          end;
        eCUD : {eDown, eHPR, eIND} {etVT52, etANSI, etVT100}
          begin
            {margin check}
            if ((((bY-bYPos)+1) >= cMarginTop) and
               (((bY-bYPos)+1) <= cMarginBottom))
               or
               {will cursor 'pass through' margin}
               ((((bY-bYPos)+1) < cMarginBottom) and
               (((bY-bYPos)+1+Y) > cMarginBottom)) then
              bInMargins := True
            else
              bInMargins := False;

            if bY+Y < bHeight then begin
              Inc(bY, Y);

              {check if in a scrolling area and limit bottom}
              if bInMargins and (((bY-bYPos)+1) > cMarginBottom) then
                bY := (bYPos+cMarginBottom)-1
              {limit check for bottom of client}
              else if bY >= (bYPos+cHeight) then
                bY := (bYPos+cHeight)-1;

              {Update the caret position}
              bMoveCaret;
            end;
          end;
        eCUF : {eRight} {etVT52, etANSI, etVT100}
          if bX+X < bWidth then begin
            Inc(bX, X);
            {Update the caret position}
            bMoveCaret;
          end;
        eCUB : {eLeft} {etVT52, etANSI, etVT100}
          begin
            if X > bX then
              X := bX;
            Dec(bX, X);
            {Update the caret position}
            bMoveCaret;
          end;
        eClearBelow,
        eClearAbove,
        eClearScreen,
        eED : {etVT52, etANSI, etVT100}
          begin
            TempBColor := bbColor;
            if Y = 1 then begin
              if ByteFlagIsSet(ExtAttr, eAttrInverse) then
                bbColor := bfColor;
            end;
            case X of
              0 : {eClearBelow}
                begin
                  Start := (bY*bWidth)+bX;
                  ClearPart(Start, bBufferSize);
                end;
              1 : {eClearAbove}
                begin
                  Limit := (bY*bWidth)+bX+1;
                  ClearPart(0, Limit);
                end;
              2 : bClearScreen; {eClearScreen}
            end;
            if Y = 1 then
              bbColor := TempBColor;
          end;
        eClearEndOfLine,
        eClearStartOfLine,
        eClearLine,
        eEL : {etVT52, etANSI, etVT100}
          begin
            TempBColor := bbColor;
            if Y = 1 then begin
              if ByteFlagIsSet(ExtAttr, eAttrInverse) then
                bbColor := bfColor;
            end;
            case X of
              0 : {eClearEndOfLine}
                begin
                  Start := (bY*bWidth)+bX;
                  Limit := Start+(bWidth-bX)+1;
                  if (Limit > (bHeight * bWidth)) then
                    Limit := bHeight * bWidth;                    
                  ClearPart(Start, Limit);
                end;
              1 : {eClearStartOfLine}
                begin
                  Start := bY*bWidth;
                  Limit := Start+bX+1;
                  ClearPart(Start, Limit);
                end;
              2 : {eClearLine}
                begin
                  Start := bY*bWidth;
                  Limit := Start+bWidth;
                  ClearPart(Start, Limit);
                end;
            end;
            if Y = 1 then
              bbColor := TempBColor;
          end;
        eSaveCursorPos : {etANSI, etVT100}
          begin
            bSaveFlag := True;
            bSaveXLoc := bX;
            bSaveYLoc := bY;
            bSaveAttr   := (bbColor shl 4) or bfColor;
            bSaveAttrEx :=  bExtAttr;
          end;
        eRestoreCursorPos : {etANSI, etVT100}
          begin
            if bSaveFlag then begin
              bX := bSaveXLoc;
              bY := bSaveYLoc;
              bbColor := bSaveAttr shr 4;
              bfColor := bSaveAttr and $0F;
              bExtAttr := bSaveAttrEx;
              bSaveFlag := False;
            end else begin
              if (bEC.emuType = etANSI) then begin
                bX := bXPos;
                bY := bYPos;
                bbColor := emBlack;
                bfColor := emWhite;
                bExtAttr := 0;
              end;
            end;

            {Update the caret position}
            bMoveCaret;
          end;
        eDSR : {eDeviceStatusReport} {etANSI, etVT100}
          begin
            if X = 6 then
              ReportCursorPosition;
          end;

        eCHA : {eHPA} {etANSI}
          begin
            if Integer(X)-1 >= 0 then
              bX := bXPos + (X-1);

            {Limit checks...}
            if bX >= bWidth then
              bX := bWidth-1
            else if Integer(bX) < 0 then
              bX := 0;

            {Update the caret position}
            bMoveCaret;
          end;
        eCNL : {etANSI}
          begin
            if Y = 0 then
              Y := 1;
            if bY+Y < bHeight then
              Inc(bY, Y);
            bX := bXPos;

            {Update the caret position}
            bMoveCaret;
          end;
        eCPL : {etANSI}
          begin
            if ((((bY-bYPos)+1) >= cMarginTop) and
                (((bY-bYPos)+1) <= cMarginBottom)) then
              bInMargins := True
            else
              bInMargins := False;

            if Y = 0 then
              Y := 1;
            if Y > bY then
              Y := bY;
            Dec(bY, Y);
            bX := bXPos;

            {Update the caret position}
            bMoveCaret;
          end;
        eVPA :{etANSI}
          begin
            if Integer(Y) > 0 then
              bY := bYPos + (Y-1);

            {Limit checks...}
            if bY >= bHeight then
              bY := bHeight-1
            else if integer(bY) < 0 then
              bY := 0;

            {Update the caret position}
            bMoveCaret;
          end;
        eDCH : {etANSI}
          begin
            Start := (bY*bWidth)+bX;
            Limit := Start+X;
            Move(bScreenBuffer^[Limit], bScreenBuffer^[Start],
                     bBufferLimit-(Limit));
            Move(bAttrBuffer^[Limit], bAttrBuffer^[Start],
                     bBufferLimit-(Limit));
            Move(bAttrBufferB^[Limit], bAttrBufferB^[Start],
                     bBufferLimit-(Limit));
            Move(bExtAttrBuffer^[Limit], bExtAttrBuffer^[Start],
                     bBufferLimit-(Limit));

            GetChangedRect(Start, Limit, UpdateRect);  
            InvalidateRect(bWnd, @UpdateRect, False);
            UpdateWindow(bWnd);
          end;
        eDL : {etANSI}
          begin
            if Y = 0 then
              Y := 1;

            if (bYPos-bPageHeight) >= 0 then
              if Y > (bYPos-bPageHeight) then
                Y := (bYPos-bPageHeight);

            Start := bY*bWidth;
            Limit := Start+(Y*bWidth);
            Move(bScreenBuffer^[Limit],  bScreenBuffer^[Start],
                     bBufferLimit-Limit);
            Move(bAttrBuffer^[Limit],    bAttrBuffer^[Start],
                     bBufferLimit-Limit);
            Move(bAttrBufferB^[Limit],   bAttrBufferB^[Start],
                     bBufferLimit-Limit);
            Move(bExtAttrBuffer^[Limit], bExtAttrBuffer^[Start],
                     bBufferLimit-Limit);

            GetChangedRect(Start, Start+(cMarginBottom*bWidth), UpdateRect);
            InvalidateRect(bWnd, @UpdateRect, False);
            UpdateWindow(bWnd);
          end;
        eECH : {etANSI}
          begin
            Start := (bY*bWidth)+bX;
            Limit := Start+X;
            ClearPart(Start, Limit);
          end;
        eICH : {etANSI}
          begin
            Start := (bY*bWidth)+bX;
            Limit := Start+X;
            if Limit > ((bY+1)*bWidth) then
              Limit := ((bY+1)*bWidth);
            if Limit < ((bY+1)*bWidth) then begin
              MoveSize := bWidth-(X+bX);
              Move(bScreenBuffer^[Start], bScreenBuffer^[Limit], MoveSize);
              Move(bAttrBuffer^[Start], bAttrBuffer^[Limit], MoveSize);
              Move(bAttrBufferB^[Start], bAttrBufferB^[Limit], MoveSize);
              Move(bExtAttrBuffer^[Start], bExtAttrBuffer^[Limit], MoveSize);
            end;
            ClearPart(Start, Limit);
          end;
        eIL : {etANSI, etVT100}
          begin
            if ((((bY-bYPos)+1) >= cMarginTop) and
               (((bY-bYPos)+1) <= cMarginBottom)) then
              bInMargins := True
            else
              bInMargins := False;

            Start := bY*bWidth;
            Limit := Start+(Y*bWidth);

            MoveSize := bPageHeight*bWidth;

            if Limit > MoveSize then
              MoveSize := (MoveSize - (Limit-Start))
            else
              Dec(MoveSize, Limit);

            if Limit < bBufferSize then begin                      
              Move(bScreenBuffer^[Start], bScreenBuffer^[Limit], MoveSize);
              Move(bAttrBuffer^[Start], bAttrBuffer^[Limit], MoveSize);
              Move(bAttrBufferB^[Start], bAttrBufferB^[Limit], MoveSize);
              Move(bExtAttrBuffer^[Start], bExtAttrBuffer^[Limit], MoveSize);
            end;                                                   
            ClearPart(Start, Limit);

            GetChangedRect(Start, Start+(cMarginBottom*bWidth), UpdateRect);
            InvalidateRect(bWnd, @UpdateRect, False);
            UpdateWindow(bWnd);
          end;
        eCPR : {etANSI, etVT100}
          SendMessage(bWnd, apw_CursorPosReport, X, Y);
        eDA  : {etANSI, etVT100}
          begin
            Case X of
              0 : ReportDeviceAttributes(Y);
            end;
          end;
        eNEL : {etANSI, etVT100}
          begin
            if ((((bY-bYPos)+1) >= cMarginTop) and
               (((bY-bYPos)+1) <= cMarginBottom)) then
              bInMargins := True
            else
              bInMargins := False;

            if bY+1 < bHeight then
              Inc(bY, 1);
            bX := 0;

            {Update the caret position}
            bMoveCaret;
          end;
         {-tabulation}
        eCBT : {etANSI}
          begin
            bX := bGetPrevTabStop(bX+1, X, bHorizTabStop^,
                                  SizeOf(THorizontalTabStop))-1;
            {Update the caret position}
            bMoveCaret;
           end;
        eCHT : {etANSI}
          begin
            bX := bGetNextTabStop(bX+1, X, bHorizTabStop^,
                                  SizeOf(THorizontalTabStop))-1;

            {Update the caret position}
            bMoveCaret;
          end;
        eCTC : {etANSI}
          begin
            case X of
              0 : bSetHorizontalTabStop(bX+1);
              1 : begin
                    if bY > bPageHeight-1 then
                      Start := bPageHeight
                    else
                      Start := bY+1;
                    bSetVerticalTabStop(Start);
                  end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -