Index: sakura_core/CViewCommander.cpp =================================================================== --- sakura_core/CViewCommander.cpp (リビジョン 1904) +++ sakura_core/CViewCommander.cpp (作業コピー) @@ -6932,14 +6932,7 @@ // その位置を記憶する. if( bSelectedArea ){ if( bBeginBoxSelect ){ // 矩形選択 - CLogicPoint ptWork; - rLayoutMgr.LayoutToLogic( - CLayoutPoint(sRangeA.GetTo().x,ptOld.y), - &ptWork - ); - ptColLineP.x = ptWork.x; - if( nLen - pcLayout->GetDocLineRef()->GetEol().GetLen() > ptColLineP.x + colDif ) - nLen = ptColLineP.GetX2() + CLogicInt(colDif); + nLen = ptColLineP.GetX2(); // 行単位で置換するので colDifは常に 0。 } else { // 通常の選択 if( ptColLineP.y+linDif == (Int)ptOld.y ){ //$$ 単位混在 if( nLen - pcLayout->GetDocLineRef()->GetEol().GetLen() > ptColLineP.x + colDif ) @@ -6947,11 +6940,6 @@ } } } - - if(pcLayout->GetDocLineRef()->GetLengthWithoutEOL() < nLen) - ptOld.x = (CLayoutInt)(Int)pcLayout->GetDocLineRef()->GetLengthWithoutEOL() + 1; //$$ 単位混在 - else - ptOld.x = (CLayoutInt)(Int)nLen; //$$ 単位混在 } if( int nReplace = cRegexp.Replace(pLine, nLen, nIdx) ){ @@ -6960,6 +6948,10 @@ // 行単位での置換処理 // 選択範囲を物理行末までにのばす rLayoutMgr.LogicToLayout( CLogicPoint(nLen, pcLayout->GetLogicLineNo()), GetSelect().GetToPointer() ); + ptOld = GetSelect().GetTo(); + if( bSelectedArea && ! bBeginBoxSelect ) { + ptOld.x = (CLayoutInt)(Int)std::min(nLen, pcLayout->GetDocLineRef()->GetLengthWithoutEOL()+1); + } } else { // From Here Jun. 6, 2005 かろと // 物理行末までINSTEXTする方法は、キャレット位置を調整する必要があり、