// 未選択ならエラー
if(!selecting ){
beep;
endmacro;
}

// 選択範囲を記憶
#topX1 = seltopx; #topY1 = seltopy;
#endX1 = selendx; #endY1 = selendy;

// 選択範囲の末尾へ移動し選択解除
escape;
moveto #endX1, #endY1;

// 改行以外に出会うまで左へ移動し、移動後の位置から選択を開始
call Skip 'R';
#endX2 = x; #endY2 = y;
beginsel;
// 数字以外に出会うまで左へ移動し、移動後の位置で選択を終了
call Skip 'N';
#topX2 = x; #topY2 = y;
endsel;

// 選択されなかった(数字部なし)ならエラー
// 選択された(数字部あり)なら、その数値に1を加えた文字列を上書き
if(#topX2==#endX2 && #topY2==#endY2){
escape;
beep;
}else{
insert str(val(gettext(#topX2, #topY2, #endX2, #endY2, 1))+1);
}
endmacro;