To: vim-dev@vim.org Subject: Patch 6.2.356 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.356 Problem: When using a double-byte 'encoding' and 'selection' is "exclusive", "vy" only yanks the first byte of a double-byte character. (Xiangjiang Ma) Solution: Correct the column in unadjust_for_sel() to position on the first byte, always include the trailing byte of the selected text. Files: src/normal.c *** ../vim-6.2.355/src/normal.c Fri Mar 12 21:13:03 2004 --- src/normal.c Sun Mar 14 17:42:30 2004 *************** *** 1700,1713 **** #endif #ifdef FEAT_MBYTE ! /* Include the trailing byte of a multi-byte char. Don't do it when ! * VIsual_active is TRUE and 'sel' is "exclusive", the position has ! * already been moved to the trailing byte by adjust_for_sel() then. */ ! if (has_mbyte && oap->inclusive ! # ifdef FEAT_VISUAL ! && (!oap->is_VIsual || *p_sel != 'e') ! # endif ! ) { int l; --- 1700,1707 ---- #endif #ifdef FEAT_MBYTE ! /* Include the trailing byte of a multi-byte char. */ ! if (has_mbyte && oap->inclusive) { int l; *************** *** 1733,1739 **** ); /* * For delete, change and yank, it's an error to operate on an ! * empty region, when 'E' inclucded in 'cpoptions' (Vi compatible). */ empty_region_error = (oap->empty && vim_strchr(p_cpo, CPO_EMPTYREGION) != NULL); --- 1727,1733 ---- ); /* * For delete, change and yank, it's an error to operate on an ! * empty region, when 'E' included in 'cpoptions' (Vi compatible). */ empty_region_error = (oap->empty && vim_strchr(p_cpo, CPO_EMPTYREGION) != NULL); *************** *** 7738,7744 **** --- 7745,7756 ---- else #endif if (pp->col > 0) + { --pp->col; + #ifdef FEAT_MBYTE + mb_adjustpos(pp); + #endif + } else if (pp->lnum > 1) { --pp->lnum; *** ../vim-6.2.355/src/version.c Sun Mar 14 20:12:26 2004 --- src/version.c Sun Mar 14 20:15:01 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 356, /**/ -- How To Keep A Healthy Level Of Insanity: 9. As often as possible, skip rather than walk. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///