To: vim-dev@vim.org Subject: Patch 6.2f.036 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2f.036 Problem: Moving leftwards over text with an illegal UTF-8 byte moves one byte instead of one character. Solution: Ignore an illegal byte after the cursor position. Files: src/mbyte.c *** ../vim-6.2f.035/src/mbyte.c Fri May 30 21:18:58 2003 --- src/mbyte.c Sat May 31 18:12:56 2003 *************** *** 2242,2249 **** /* Move q to the first byte of this char. */ while (q > base && (*q & 0xc0) == 0x80) --q; ! /* Check for illegal sequence. */ ! if (utf8len_tab[*q] != (int)(s - q + 1)) return 0; if (q <= base) --- 2242,2251 ---- /* Move q to the first byte of this char. */ while (q > base && (*q & 0xc0) == 0x80) --q; ! /* Check for illegal sequence. Do allow an illegal byte after where we ! * started. */ ! if (utf8len_tab[*q] != (int)(s - q + 1) ! && utf8len_tab[*q] != (int)(p - q + 1)) return 0; if (q <= base) *** ../vim-6.2f.035/src/version.c Sat May 31 16:45:27 2003 --- src/version.c Sat May 31 18:10:01 2003 *************** *** 632,633 **** --- 632,635 ---- { /* Add new patch number below this line */ + /**/ + 36, /**/ -- Everyone has a photographic memory. Some don't have film. /// 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 ///