|
意外とマクロ行数がかかりました。
1:選択範囲を行で区切り確保
2:連続空白の縮約を先に処理
3:最後に行の一本化を実行
//normalizeSpace.mac
// 半角空白でテストした
if(selecting){ // 行範囲ではうまくゆくかな?
// 最終行末の空白は取れてないです
#seltopx=seltopx;#seltopy=seltopy;#selendx=selendx;#selendy=selendy;
escape;
moveto #selendx,#selendy;insertreturn;#selendy=y;
moveto #seltopx,#seltopy;insertreturn;#seltopy=y;#selendy=1+#selendy;
beginsel;moveto 0,#selendy;left 1;
menu "j";
replaceall " +"," ",regular,inselect;
moveto 0,#seltopy;beginsel;moveto 0,#selendy;left 1;
menu "k";
replaceall " \n "," \n",regular,inselect;
moveto 0,#seltopy;beginsel;moveto 0,#selendy;left 1;
menu "p";
replaceall "\n","",regular,inselect;
moveto 0,#seltopy;backspace;
}else{
replaceall "\n","",regular;
replaceall " +"," ",regular;
}
endmacro
|
|