// 対応する括弧を閉じる by IKKI (2004/05/17) $OpenKakko = "([{<(〔[{〈《「『【"; $CloseKakko = ")]}>)〕]}〉》」』】"; $AnyKakkoRegEx = "[([{<(〔[{〈《「『【)\\]}>)〕]}〉》」』】]"; disabledraw; $searchbuffer = searchbuffer; #searchoption = searchoption; call Main; setsearch $searchbuffer, #searchoption; endmacro; Main: #ox = x; #oy = y; call FindPair; moveto #ox, #oy; if (##return < 0) return false; ##paircode = ascii(midstr($CloseKakko, ##return, 2)); if (##paircode < 0x7F) { ##_ = sendmessage(hidemaruhandle(0), 0x0102, ##paircode, 1); // C 言語用の自動アンインデント } else { insert char(##paircode); } return true; FindPair: searchup $AnyKakkoRegEx, regular; while (result) { if (colorcode & 0x1F != 3 && colorcode & 0x1F != 20) { // 文字定数内とコメント内で gokakko; は使えない ##foundone = strstr($OpenKakko, gettext(foundtopx, foundtopy, foundendx, foundendy)); if (##foundone >= 0) return ##foundone; gokakko; } findup; } return -1;