diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index c8c9fb14..0de1c9d7 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -6997,3 +6997,9 @@ lib/readline/display.c since we are on the first line, and only do this if we inserted more bytes than wrap_offset (old code checked _rl_last_c_pos, which is wrong in the presence of multibyte characters) + + 12/5 + ---- +lib/readline/display.c + - ADJUST_CPOS: define macro and use it in places where _rl_last_c_pos + is changed diff --git a/lib/readline/display.c b/lib/readline/display.c index 09cec440..66c09192 100644 --- a/lib/readline/display.c +++ b/lib/readline/display.c @@ -1502,6 +1502,8 @@ rl_redisplay (void) _rl_release_sigint (); } +#define ADJUST_CPOS(x) do { _rl_last_c_pos -= (x) ; cpos_adjusted = 1; } while (0) + /* PWP: update_line() is based on finding the middle difference of each line on the screen; vis: @@ -1767,7 +1769,7 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv memset (&ps_old, 0, sizeof(mbstate_t)); /* Are the old and new lines the same? */ - if (omax == nmax && STREQN (new, old, omax)) + if (omax == nmax && memcmp (new, old, omax) == 0) { old_offset = omax; new_offset = nmax; @@ -1845,12 +1847,6 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv memset (&ps_old, 0, sizeof (mbstate_t)); memset (&ps_new, 0, sizeof (mbstate_t)); -#if 0 - /* On advice from jir@yamato.ibm.com */ - _rl_adjust_point (old, ols - old, &ps_old); - _rl_adjust_point (new, nls - new, &ps_new); -#endif - if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0) break; @@ -1917,6 +1913,10 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv visible_wrap_offset based on what we know. */ if (current_line == 0) visible_wrap_offset = prompt_invis_chars_first_line; /* XXX */ +#if 0 /* XXX - not yet */ + else if (current_line == prompt_last_screen_line && wrap_offset > prompt_invis_chars_first_line) + visible_wrap_offset = wrap_offset - prompt_invis_chars_first_line +#endif if ((mb_cur_max == 1 || rl_byte_oriented) && current_line == 0 && visible_wrap_offset) _rl_last_c_pos += visible_wrap_offset; } @@ -1993,7 +1993,7 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv to just output the prompt from the beginning of the line up to the first difference, but you don't know the number of invisible characters in that case. - This needs a lot of work to be efficient. */ + This needs a lot of work to be efficient, but it usually doesn't matter. */ if ((od <= prompt_last_invisible || nd <= prompt_last_invisible)) { nfd = new + lendiff; /* number of characters we output above */ @@ -2018,10 +2018,8 @@ dumb_update: current_line == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth && _rl_horizontal_scroll_mode == 0) - { - _rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line; - cpos_adjusted = 1; - } + ADJUST_CPOS (wrap_offset - prompt_invis_chars_first_line); + /* If we just output a new line including the prompt, and the prompt includes invisible characters, we need to account for them in the _rl_last_c_pos calculation, since @@ -2033,10 +2031,7 @@ dumb_update: local_prompt_len <= temp && wrap_offset >= prompt_invis_chars_first_line && _rl_horizontal_scroll_mode == 0) - { - _rl_last_c_pos -= prompt_invis_chars_first_line; - cpos_adjusted = 1; - } + ADJUST_CPOS (prompt_invis_chars_first_line); } else _rl_last_c_pos += temp; @@ -2092,6 +2087,7 @@ dumb_update: which we do below, so we do the same thing if we don't call _rl_col_width. We don't have to compare, since we know the characters are the same. + The check of differing numbers of invisible chars may be extraneous. XXX - experimental */ if (current_line == 0 && nfd == new && newchars > prompt_last_invisible && newchars <= local_prompt_len && @@ -2130,12 +2126,15 @@ dumb_update: col_lendiff = lendiff; /* col_lendiff uses _rl_col_width(), which doesn't know about whether or not - the multibyte characters it counts are invisible, so the count is short by - the number of bytes in the invisible multibyte characters - the number of - multibyte characters. We don't have a good way to solve this without - moving to something like a bitmap that indicates which characters are - visible and which are invisible. We fix it up (imperfectly) in the - caller. */ + the multibyte characters it counts are invisible, so unless we're printing + the entire prompt string (in which case we can use prompt_physical_chars) + the count is short by the number of bytes in the invisible multibyte + characters - the number of multibyte characters. + + We don't have a good way to solve this without moving to something like + a bitmap that indicates which characters are visible and which are + invisible. We fix it up (imperfectly) in the caller and by trying to use + the entire prompt string wherever we can. */ /* If we are changing the number of invisible characters in a line, and the spot of first difference is before the end of the invisible chars, @@ -2183,15 +2182,12 @@ dumb_update: if (lendiff < 0) { _rl_output_some_chars (nfd, temp); - _rl_last_c_pos += col_temp; /* XXX - was _rl_col_width (nfd, 0, temp, 1); */ + _rl_last_c_pos += col_temp; /* If nfd begins before any invisible characters in the prompt, adjust _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to let the caller know. */ if (current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible)) - { - _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */ - cpos_adjusted = 1; - } + ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */ return; } /* Sometimes it is cheaper to print the characters rather than @@ -2241,10 +2237,7 @@ dumb_update: prompt, adjust _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to let the caller know. */ if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible)) - { - _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */ - cpos_adjusted = 1; - } + ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */ return; } @@ -2254,10 +2247,7 @@ dumb_update: prompt, adjust _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to let the caller know. */ if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible)) - { - _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */ - cpos_adjusted = 1; - } + ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */ } } else @@ -2278,10 +2268,8 @@ dumb_update: displaying_prompt_first_line && wrap_offset != prompt_invis_chars_first_line && ((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth+prompt_invis_chars_first_line)))) - { - _rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line; - cpos_adjusted = 1; - } + ADJUST_CPOS (wrap_offset - prompt_invis_chars_first_line); + /* XXX - what happens if wrap_offset == prompt_invis_chars_first_line and we are drawing the first line (current_line == 0)? We should adjust by _rl_last_c_pos -= prompt_invis_chars_first_line */ @@ -2330,10 +2318,7 @@ dumb_update: prompt_invis_chars_first_line && _rl_last_c_pos >= prompt_invis_chars_first_line && ((nfd - new) <= prompt_last_invisible)) - { - _rl_last_c_pos -= prompt_invis_chars_first_line; - cpos_adjusted = 1; - } + ADJUST_CPOS (prompt_invis_chars_first_line); #if 1 #ifdef HANDLE_MULTIBYTE @@ -2378,10 +2363,7 @@ dumb_update: displaying_prompt_first_line && _rl_last_c_pos > wrap_offset && ((nfd - new) <= prompt_last_invisible)) - { - _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */ - cpos_adjusted = 1; - } + ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */ } } clear_rest_of_line: diff --git a/po/zh_TW.po b/po/zh_TW.po index 0e3e57fb..7c45bf1c 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -11,9 +11,9 @@ msgstr "" "Project-Id-Version: bash 5.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-12-19 15:52-0500\n" -"PO-Revision-Date: 2019-07-16 22:22+0800\n" +"PO-Revision-Date: 2019-12-06 23:37+0800\n" "Last-Translator: pan93412 \n" -"Language-Team: Chinese (traditional) \n" +"Language-Team: Chinese (traditional) \n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -477,7 +477,7 @@ msgstr "在不帶工作控制的情況下啟動了工作 %d" #: builtins/getopt.c:110 #, c-format msgid "%s: illegal option -- %c\n" -msgstr "%s: 非法選項 -- %c\n" +msgstr "%s:不合法的選項 ─ %c\n" #: builtins/getopt.c:111 #, c-format @@ -567,7 +567,7 @@ msgstr "%s: 參數必須是行程或工作 ID" #: builtins/kill.def:274 msgid "Unknown error" -msgstr "不明錯誤" +msgstr "未知錯誤" #: builtins/let.def:97 builtins/let.def:122 expr.c:638 expr.c:656 msgid "expression expected" @@ -1180,7 +1180,7 @@ msgstr "已完成" #: jobs.c:1673 siglist.c:123 msgid "Stopped" -msgstr "已停止" +msgstr "停止" #: jobs.c:1677 #, c-format @@ -1726,19 +1726,19 @@ msgstr "偽訊號" #: siglist.c:51 msgid "Hangup" -msgstr "結束通話" +msgstr "掛斷" #: siglist.c:55 msgid "Interrupt" -msgstr "中斷" +msgstr "中止" #: siglist.c:59 msgid "Quit" -msgstr "退出" +msgstr "結束" #: siglist.c:63 msgid "Illegal instruction" -msgstr "非法的指令" +msgstr "無效指令" #: siglist.c:67 msgid "BPT trace/trap" @@ -1754,11 +1754,11 @@ msgstr "模擬器陷阱指令" #: siglist.c:83 msgid "Floating point exception" -msgstr "浮點數異常" +msgstr "期望浮點數" #: siglist.c:87 msgid "Killed" -msgstr "已砍除" +msgstr "強制結束" #: siglist.c:91 msgid "Bus error" @@ -1766,15 +1766,15 @@ msgstr "匯流排錯誤" #: siglist.c:95 msgid "Segmentation fault" -msgstr "區段錯誤" +msgstr "程式記憶體區段錯誤" #: siglist.c:99 msgid "Bad system call" -msgstr "錯誤的系統呼叫" +msgstr "無效系統呼叫" #: siglist.c:103 msgid "Broken pipe" -msgstr "管道中斷" +msgstr "管線損壞" #: siglist.c:107 msgid "Alarm clock" @@ -1782,7 +1782,7 @@ msgstr "鬧鐘" #: siglist.c:111 msgid "Terminated" -msgstr "已終止" +msgstr "終止" #: siglist.c:115 msgid "Urgent IO condition" @@ -1790,7 +1790,7 @@ msgstr "緊急 I/O 狀況" #: siglist.c:119 msgid "Stopped (signal)" -msgstr "已停止(訊號)" +msgstr "停止(信號)" #: siglist.c:127 msgid "Continue" @@ -1802,11 +1802,11 @@ msgstr "子行程已死或者停止" #: siglist.c:139 msgid "Stopped (tty input)" -msgstr "已停止(tty 輸入)" +msgstr "停止(tty 輸入)" #: siglist.c:143 msgid "Stopped (tty output)" -msgstr "已停止(tty 輸出)" +msgstr "停止(tty 輸出)" #: siglist.c:147 msgid "I/O ready" @@ -1830,7 +1830,7 @@ msgstr "警報(側寫)" #: siglist.c:167 msgid "Window changed" -msgstr "視窗已變更" +msgstr "已變更視窗" #: siglist.c:171 msgid "Record lock" @@ -5379,27 +5379,3 @@ msgstr "" "從一個檔案中讀取列到陣列變數中\n" " \n" " 一個「mapfile」的同義詞。" - -#~ msgid "Copyright (C) 2012 Free Software Foundation, Inc." -#~ msgstr "著作權所有 (C) 2013 自由軟體基金會。" - -#~ msgid ":" -#~ msgstr ":" - -#~ msgid "true" -#~ msgstr "true" - -#~ msgid "false" -#~ msgstr "false" - -#~ msgid "times" -#~ msgstr "times" - -#~ msgid "requesting resize" -#~ msgstr "要求調整" - -#~ msgid "just resized" -#~ msgstr "只是調整大小" - -#~ msgid "bug: unknown operation" -#~ msgstr "bug:不明操作"