To: vim-dev@vim.org Subject: Patch 6.2f.024 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2f.024 Problem: When 'delcombine' is set and a character has more than two composing characters "x" deletes them all. Solution: Always delete only the last composing character. Files: src/misc1.c *** ../vim-6.2f.023/src/misc1.c Mon May 26 22:15:06 2003 --- src/misc1.c Thu May 29 20:32:05 2003 *************** *** 2055,2064 **** colnr_T col = curwin->w_cursor.col; int was_alloced; long movelen; - #ifdef FEAT_MBYTE - int p0, p1, p2; - int p0len, p1len, p2len; - #endif oldp = ml_get(lnum); oldlen = (int)STRLEN(oldp); --- 2055,2060 ---- *************** *** 2070,2100 **** return FAIL; #ifdef FEAT_MBYTE ! if (p_deco && enc_utf8) { ! p1 = p2 = 0; ! /* see if there are any combining characters: */ ! p0 = utfc_ptr2char(oldp + col, &p1, &p2); ! p0len = utf_char2len(p0); ! p1len = p1 != 0 ? utf_char2len(p1) : 0; ! p2len = p2 != 0 ? utf_char2len(p2) : 0; ! /* don't try anything if trying to del more than one 'char' */ ! if ((count <= (p0len + p1len + p2len)) && p1 != 0) { ! /* We are here because there are combining characters; either ! * p1, p2 or both. We need to remove just that character, and ! * leave the cursor where it was. */ ! ! /* since p1 is always valid, adjust for it */ ! col += p0len; ! count = p1len; ! if (p2 != 0) { ! /* p2 is valid, so remove it instead of p1 */ ! col += p1len; ! count = p2len; ! } fixpos = 0; } } --- 2066,2089 ---- return FAIL; #ifdef FEAT_MBYTE ! /* If 'delcombine' is set and deleting (less than) one character, only ! * delete the last combining character. */ ! if (p_deco && enc_utf8 && (*mb_ptr2len_check)(oldp + col) <= count) { ! int c1, c2; ! int n; ! (void)utfc_ptr2char(oldp + col, &c1, &c2); ! if (c1 != NUL) { ! /* Find the last composing char, there can be several. */ ! n = col; ! do { ! col = n; ! count = utf_ptr2len_check(oldp + n); ! n += count; ! } while (UTF_COMPOSINGLIKE(oldp + col, oldp + n)); fixpos = 0; } } *** ../vim-6.2f.023/src/version.c Thu May 29 19:54:32 2003 --- src/version.c Thu May 29 20:38:56 2003 *************** *** 632,633 **** --- 632,635 ---- { /* Add new patch number below this line */ + /**/ + 24, /**/ -- If they don't keep on exercising their lips, he thought, their brains start working. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// 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 ///