#22515
Yutaka Emura
キーマスター

ent 様

いつもお世話になっております。江村です。

マクロを作成しましたので、お試しください。


x1 = document.selection.GetTopPointX( eePosLogical );
y1 = document.selection.GetTopPointY( eePosLogical );
x2 = document.selection.GetBottomPointX( eePosLogical );
y2 = document.selection.GetBottomPointY( eePosLogical );
s = document.selection.Text;
n = s.charCodeAt( s.length - 1 );
if( n == 13 || n == 10 ) {   // CR or LF, remove the last character
	s = s.substr( 0, s.length - 1 );
	if( n == 10 && s.charCodeAt( s.length - 1 ) == 13 ) {   // if n was LF, check for CR
		s = s.substr( 0, s.length - 1 );
	}
	y2--;
	x2 = document.GetLine( y1 ).length + 1;
}
else {  // add CR+LF
	s = s + "\r\n";
	y2++;
	x2 = 1;
}
document.selection.Text = s;
document.selection.SetAnchorPoint( eePosLogical, x1, y1 );
document.selection.SetActivePoint( eePosLogical, x2, y2, true );

よろしくお願いします。