Changeset 7318 for lang/actionscript

Show
Ignore:
Timestamp:
03/01/08 15:11:23 (5 years ago)
Author:
frsyuki
Message:

lang/actionscript/FxTerm: fixed new line behavior 2

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/actionscript/FxTerm/trunk/FxTerm.as

    r7316 r7318  
    429429                        cursorCanvas.graphics.clear(); 
    430430                        // FIXME  cursor color 
     431                        var drow:int; 
     432                        var dcol:int; 
     433                        if( ccol >= cols ) { 
     434                                drow = (crow+1 < rows ? crow+1 : rows - 1); 
     435                                dcol = 0; 
     436                        } else { 
     437                                drow = crow; 
     438                                dcol = ccol; 
     439                        } 
    431440                        cursorCanvas.graphics.beginFill(ansiForegroundColors[7], 1.0); 
    432441                        cursorCanvas.graphics.drawRect( 
    433                                         (this.width / cols - 0.05) * ccol + 2, 
    434                                         lineHeight * crow + lineGapFilling, 
    435                                         ( screen[crow][ccol].wide ? 
     442                                        (this.width / cols - 0.05) * dcol + 2, 
     443                                        lineHeight * drow + lineGapFilling, 
     444                                        ( screen[drow][dcol].wide ? 
    436445                                          calibrateFontWidth * 2 - 2 :  // wide width 
    437446                                          calibrateFontWidth ), 
     
    595604                var screen:Array = _screen; 
    596605                var wide:Boolean = isWideCharacter(c); 
    597                 if( wide ) { 
    598                         if( ccol+1 >= cols ) { 
    599                                 screen[crow][ccol].wide = false; 
    600                                 screen[crow][ccol].text = " "; 
    601                                 cursorLineDown(); 
    602                                 ccol = 0; 
    603                         } 
    604                 } else { 
    605                         /*  FIXME 
    606                         if( ccol >= cols ) { 
    607                                 cursorLineDown(); 
    608                                 ccol = 0; 
    609                         } 
    610                         */ 
     606                if( ccol >= cols ) { 
     607                        cursorLineDown(); 
     608                        screen = _screen; 
     609                        ccol = 0; 
     610                } else if( wide && ccol+1 >= cols ) { 
     611                        screen[crow][ccol].wide = false; 
     612                        screen[crow][ccol].text = " "; 
     613                        cursorLineDown(); 
     614                        screen = _screen; 
     615                        ccol = 0; 
    611616                } 
    612617                screen[crow][ccol].text = c; 
     
    628633                        } 
    629634                        ccol++; 
    630                 } 
    631                 if( ccol >= cols ) { // FIXME 
    632                         cursorLineDown(); 
    633                         ccol = 0; 
    634635                } 
    635636                cursorDirty = true; 
     
    894895                var r:uint; 
    895896                var c:uint; 
     897                var dcol:int; 
    896898                if( param.length > 0 && param[0] == 2 ) { 
    897899                        // clear whole screen 
     
    907909                        } 
    908910                        lineDirty[crow] = true; 
    909                         for(c = 0; c <= ccol; ++c) { 
     911                        dcol = (ccol < cols ? ccol : cols - 1); 
     912                        for(c = 0; c <= dcol; ++c) { 
    910913                                screen[crow][c].clear(curattr); 
    911914                        } 
     
    913916                        // clear from current cursor position to the end 
    914917                        lineDirty[crow] = true; 
    915                         for(c = 0; c <= ccol; ++c) { 
     918                        dcol = (ccol < cols ? ccol : cols - 1); 
     919                        for(c = 0; c <= dcol; ++c) { 
    916920                                screen[crow][c].clear(curattr); 
    917921                        } 
     
    10041008                switch(cmd) { 
    10051009                case 1: 
    1006                         for(c = 0; c <= ccol; ++c) { 
     1010                        var dcol:int = (ccol < cols ? ccol : cols - 1); 
     1011                        for(c = 0; c <= dcol; ++c) { 
    10071012                                screen[crow][c].clear(curattr); 
    10081013                        } 
     
    10121017                        break; 
    10131018                default: 
    1014                         for(c = ccol; c < cols; ++c) { 
     1019                        for(c = ccol; c < cols; ++c) {  // FIXME dcol? 
    10151020                                screen[crow][c].clear(curattr); 
    10161021                        } 
     
    10271032                var n:int = (param.length > 0 && param[0] > 0) ? param[0] : 1; 
    10281033                var c:int; 
    1029  
    1030                 var poped:Array = screen[crow].splice(ccol + n); 
    1031                 var range:Array = screen[crow].splice(ccol); 
     1034                var dcol:int = (ccol < cols ? ccol : cols - 1); 
     1035 
     1036                var poped:Array = screen[crow].splice(dcol + n); 
     1037                var range:Array = screen[crow].splice(dcol); 
    10321038                for each(var cell:TextCell in poped) { cell.clear(); } 
    10331039                screen[crow] = screen[crow].concat(poped); 
     
    10411047        { 
    10421048                var screen:Array = _screen; 
     1049                var dcol:int = (ccol < cols ? ccol : cols - 1); 
    10431050 
    10441051                var n:int = (param.length > 0 && param[0] > 0) ? param[0] : 1; 
    10451052                var range:Array = screen[crow].splice(cols - n); 
    1046                 var poped:Array = screen[crow].splice(ccol); 
     1053                var poped:Array = screen[crow].splice(dcol); 
    10471054                for each(var cell:TextCell in poped) { cell.clear(); } 
    10481055                screen[crow] = screen[crow].concat(poped); 
     
    10501057 
    10511058                var c:int; 
    1052                 for(c = ccol; c < cols - n; ++c) { 
     1059                for(c = dcol; c < cols - n; ++c) { 
    10531060                        screen[crow][c].copy( screen[crow][c + n] ); 
    10541061                }