Revision: 8416 https://osdn.net/projects/ttssh2/scm/svn/commits/8416 Author: zmatsuo Date: 2019-11-28 00:26:28 +0900 (Thu, 28 Nov 2019) Log Message: ----------- URL強調上で文字を入力したとき不要な描画が発生しないようにした Modified Paths: -------------- branches/unicode_buf/teraterm/teraterm/buffer.c -------------- next part -------------- Modified: branches/unicode_buf/teraterm/teraterm/buffer.c =================================================================== --- branches/unicode_buf/teraterm/teraterm/buffer.c 2019-11-27 15:26:18 UTC (rev 8415) +++ branches/unicode_buf/teraterm/teraterm/buffer.c 2019-11-27 15:26:28 UTC (rev 8416) @@ -2899,6 +2899,33 @@ #endif #if UNICODE_INTERNAL_BUFF +/** + * \x83J\x81[\x83\\x83\x8B\x88ʒu\x82Ƃ\xCCURL\x83A\x83g\x83\x8A\x83r\x83\x85\x81[\x83g\x82̐擪\x82Ƃ̋\x97\x97\xA3\x82\xF0\x8Cv\x8EZ\x82\xB7\x82\xE9 + */ +int get_url_len(int cur_x, int cur_y) +{ + int sp = cur_x + cur_y * NumOfColumns; + int cp; + int dp; + { + int p = sp; + p--; + while (p > 0) { + int sy = p / NumOfColumns; + int sx = p % NumOfColumns; + int ptr = GetLinePtr(PageStart + sy) + sx; + if ((AttrBuff[ptr] & AttrURL) == 0) { + break; + } + p--; + } + sp = p; + } + cp = cur_x + cur_y * NumOfColumns; + dp = cp - sp; + return dp; +} + static const struct schemes_t { const wchar_t *str; int len; @@ -3081,6 +3108,9 @@ } } +/** + * \x83J\x81[\x83\\x83\x8B\x88ʒu\x82\xA9\x82\xE7URL\x8B\xAD\x92\xB2\x82\xF0\x8Ds\x82\xA4 + */ static void mark_url_w(int cur_x, int cur_y) { buff_char_t *b = &CodeLineW[cur_x]; @@ -3095,13 +3125,7 @@ int ey; int len; - // \x83J\x81[\x83\\x83\x8B\x88ʒu\x82\xAAURL - if ((AttrLine[x] & AttrURL) != 0) { - mark_url_line_w(cur_x, cur_y); - return; - } - - // 1\x82O\x82̃L\x83\x83\x83\x89\x83N\x83^\x82\xAAURL? + // 1\x82O\x82̃Z\x83\x8B\x82\xAAURL? if (x == 0) { // \x88\xEA\x94ԍ\xB6\x82̎\x9E\x82́A\x91O\x82̍s\x82\xA9\x82\xE7\x8Cp\x91\xB1\x82\xB5\x82Ă\xA2\x82āA\x91O\x82̍s\x82̍ŌオURL\x82\xBE\x82\xC1\x82\xBD\x8E\x9E if ((AttrLine[0] & AttrLineContinued) != 0) { @@ -3135,15 +3159,31 @@ if (prev == TRUE) { if (next == TRUE) { + if (isURLchar(u32)) { + // URL\x82ɂ͂\xB3\x82܂\xEA\x82Ă\xA2\x82āAURL\x82ɂȂ肦\x82\xE9\x83L\x83\x83\x83\x89\x83N\x83^ + int ptr = GetLinePtr(PageStart + cur_y) + cur_x; + AttrBuff[ptr] |= AttrURL; + return; + } // 1line\x8C\x9F\x8D\xB8 mark_url_line_w(cur_x, cur_y); return; } - if (isURLchar(u32)) { - // URL\x82\xF0\x90L\x82\xB7 - AttrLine[x] |= AttrURL; + + len = get_url_len(cur_x, cur_y); + if (len >= 9) { + // URL\x83A\x83g\x83\x8A\x83r\x83\x85\x81[\x83g\x82\xAA\x82\xA2\x82Ă\xA2\x82\xE9\x90擪\x82\xA9\x82\xE7\x81A + // 9\x95\xB6\x8E\x9A\x88ȏ㗣\x82\xEA\x82Ă\xA2\x82\xE9\x8Fꍇ\x82\xCD + // \x95\xB6\x8E\x9A\x82\xAA\x8F㏑\x82\xAB\x82\xB3\x82\xEA\x82Ă\xE0URL\x82\xAA\x89\xF3\x82\xEA\x82邱\x82Ƃ͂Ȃ\xA2 + // \x81\xA8 \x83J\x81[\x83\\x83\x8B\x88ʒu\x82\xC9URL\x83A\x83g\x83\x8A\x83r\x83\x85\x81[\x83g\x82\xF0\x82\xAF\x82\xE9 + if (isURLchar(u32)) { + // URL\x82\xF0\x90L\x82\xB7 + AttrLine[x] |= AttrURL; + } return; } + mark_url_line_w(cur_x, cur_y); + return; } // '/' \x82\xAA\x93\xFC\x97͂\xB3\x82ꂽ\x82璲\x82n\x82߂\xE9