svnno****@sourc*****
svnno****@sourc*****
2010年 1月 28日 (木) 22:42:34 JST
Revision: 3754 http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3754 Author: doda Date: 2010-01-28 22:42:34 +0900 (Thu, 28 Jan 2010) Log Message: ----------- Alternate Screen Buffer 使用中に横幅を縮めた時の復元処理がおかしかったのを修正。 Modified Paths: -------------- trunk/teraterm/teraterm/buffer.c -------------- next part -------------- Modified: trunk/teraterm/teraterm/buffer.c =================================================================== --- trunk/teraterm/teraterm/buffer.c 2010-01-28 13:28:03 UTC (rev 3753) +++ trunk/teraterm/teraterm/buffer.c 2010-01-28 13:42:34 UTC (rev 3754) @@ -3230,7 +3230,7 @@ PCHAR CodeSrc, AttrSrc, AttrSrc2, AttrSrcFG, AttrSrcBG; LONG ScrSize; LONG SrcPtr, DestPtr; - int i; + int i, CopyX, CopyY; if (SaveBuff != NULL) { if ((CodeSrc=GlobalLock(SaveBuff)) != NULL) { @@ -3241,22 +3241,18 @@ AttrSrcFG = AttrSrc2 + ScrSize; AttrSrcBG = AttrSrcFG + ScrSize; - if (SaveBuffX > NumOfColumns) { - SaveBuffX = NumOfColumns; - } - if (SaveBuffY > NumOfLines) { - SaveBuffY = NumOfLines; - } + CopyX = (SaveBuffX > NumOfColumns) ? NumOfColumns : SaveBuffX; + CopyY = (SaveBuffY > NumOfLines) ? NumOfLines : SaveBuffY; SrcPtr = 0; DestPtr = GetLinePtr(PageStart); - for (i=0; i<SaveBuffY; i++) { - memcpy(&CodeBuff[DestPtr], &CodeSrc[SrcPtr], SaveBuffX); - memcpy(&AttrBuff[DestPtr], &AttrSrc[SrcPtr], SaveBuffX); - memcpy(&AttrBuff2[DestPtr], &AttrSrc2[SrcPtr], SaveBuffX); - memcpy(&AttrBuffFG[DestPtr], &AttrSrcFG[SrcPtr], SaveBuffX); - memcpy(&AttrBuffBG[DestPtr], &AttrSrcBG[SrcPtr], SaveBuffX); + for (i=0; i<CopyY; i++) { + memcpy(&CodeBuff[DestPtr], &CodeSrc[SrcPtr], CopyX); + memcpy(&AttrBuff[DestPtr], &AttrSrc[SrcPtr], CopyX); + memcpy(&AttrBuff2[DestPtr], &AttrSrc2[SrcPtr], CopyX); + memcpy(&AttrBuffFG[DestPtr], &AttrSrcFG[SrcPtr], CopyX); + memcpy(&AttrBuffBG[DestPtr], &AttrSrcBG[SrcPtr], CopyX); SrcPtr += SaveBuffX; DestPtr = NextLinePtr(DestPtr); }