// // 単語選択右へ (2004/09/12) // by IKKI http://www18.big.or.jp/~fujiwara/ikki/ // $NameChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; if (rectselecting) #rect = yes; if (selecting) { if (seltopx == x) { ##bx = selendx; ##dx = seltopx; } else { ##bx = seltopx; ##dx = selendx; } if (seltopy == y) { ##by = selendy; ##dy = seltopy; } else { ##by = seltopy; ##dy = selendy; } moveto ##bx, ##by; if (#rect) beginrect; else beginsel; moveto ##dx, ##dy; call GoBoundary 1, 0; endsel; } else { call GoBoundary 0, 1; beginsel; call GoBoundary 1, 0; endsel; } endmacro; GoBoundary: // 境界まで移動 // ##1 = 0: 左へ 1:右へ // ##2 = 境界を越えない if ((##1 == 0 && ##2 == 0) || (##1 == 1 && ##2 == 1)) left; while (true) { if (strstr($NameChar, char(code)) >= 0) ##next = 2; // 名前文字 else if (code == 13) ##next = 0x80; // 改行 else if (code <= ' ') ##next = 0x01; // ホワイトスペース else if (code < 0x7f) ##next = 0x04; // ASCII 記号 // else ##next = 0x08; // その他 else if (code < 0xff) ##next = 0x08; // 半角カナ else if (strstr("ー゛゜ゝゞヽヾ", char(code)) >= 0) ##next = 0x130; // 長音記号等 else if (strstr("仝々〆〇", char(code)) >= 0) ##next = 0x200; // 漢字 else if (code < '0') ##next = 0x100; // 全角記号 else if (code < 'ぁ') ##next = 0x40; // 全角アルファベット else if (code < 'ァ') ##next = 0x20; // 全角ひらがな else if (code < 'Α') ##next = 0x10; // 全角カタカナ else if (code < '亜') ##next = 0x100; // 全角記号 else ##next = 0x200; // 漢字 if (##next == 0x130) { if (##prev & 0x30) { ##next = ##prev; // 長音記号は基本的に直前と同じ if (##1 == 0) ##keep = ##keep + 1; // ただし左へ進む場合は保留 } } else if (##1 == 0) { if (##keep && ##next == ##prev) ##keep = 0; if (##prev == 0x130 && (##next & 0x30)) ##prev = ##next; } if (##prev && ##prev != ##next) break; if (##1 == 0) left; else right; if (!result) break; ##prev = ##next; } if (result && ##1 == 0) right; right ##keep; // 保留した分を戻す return; // ソ|ース → [ソース] // ソー|ス → [ソース] // キ|ーの → [キー]の // キー|の → キー[の] // 新宿|ー → 新宿[ー] // 新|宿ー → [新宿]ー