To: vim-dev@vim.org Subject: Patch 6.1.408 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.408 Problem: When 'rightleft' is set unprintable character 0x0c is displayed as ">c0<". Solution: Reverse the text of the hex character. Files: src/screen.c *** ../vim61.407/src/screen.c Sat Mar 15 17:55:19 2003 --- src/screen.c Sun Mar 16 22:56:47 2003 *************** *** 140,145 **** --- 140,148 ---- static void screen_line __ARGS((int row, int coloff, int endcol, int clear_width)); # define SCREEN_LINE(r, o, e, c, rl) screen_line((r), (o), (e), (c)) #endif + #ifdef FEAT_RIGHTLEFT + static void rl_mirror __ARGS((char_u *str)); + #endif #ifdef FEAT_VERTSPLIT static void draw_vsep_win __ARGS((win_T *wp, int row)); #endif *************** *** 2925,2941 **** *p_extra = '-'; #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) /* reverse line numbers */ ! { ! char_u *c1, *c2, t; ! ! for (c1 = extra, c2 = extra + STRLEN(extra) - 1; ! c1 < c2; c1++, c2--) ! { ! t = *c1; ! *c1 = *c2; ! *c2 = t; ! } ! } #endif p_extra = extra; c_extra = NUL; --- 2928,2934 ---- *p_extra = '-'; #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) /* reverse line numbers */ ! rl_mirror(extra); #endif p_extra = extra; c_extra = NUL; *************** *** 3253,3258 **** --- 3246,3255 ---- * Illegal UTF-8 byte: display as . */ transchar_hex(extra, mb_c); + #ifdef FEAT_RIGHTLEFT + if (wp->w_p_rl) /* reverse */ + rl_mirror(extra); + #endif p_extra = extra; c = *p_extra++; mb_c = c; *************** *** 3492,3497 **** --- 3489,3498 ---- else if (c != NUL) { p_extra = transchar(c); + #ifdef FEAT_RIGHTLEFT + if ((dy_flags & DY_UHEX) && wp->w_p_rl) + rl_mirror(p_extra); /* reverse "<12>" */ + #endif n_extra = byte2cells(c) - 1; c_extra = NUL; c = *p_extra++; *************** *** 4361,4366 **** --- 4362,4387 ---- } #endif } + + #ifdef FEAT_RIGHTLEFT + /* + * Mirror text "str" for right-lieft displaying. + */ + static void + rl_mirror(str) + char_u *str; + { + char_u *p1, *p2; + int t; + + for (p1 = str, p2 = str + STRLEN(str) - 1; p1 < p2; ++p1, --p2) + { + t = *p1; + *p1 = *p2; + *p2 = t; + } + } + #endif #if defined(FEAT_WINDOWS) || defined(PROTO) /* *** ../vim61.407/src/version.c Sun Mar 16 22:28:10 2003 --- src/version.c Sun Mar 16 22:59:01 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 408, /**/ -- From "know your smileys": 8-O "Omigod!!" (done "rm -rf *" ?) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///