To: vim_dev@googlegroups.com Subject: Patch 8.2.3820 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3820 Problem: "vrc" does not replace composing characters, while "rc" does. Solution: Check the byte length including composing characters. (closes #9351) Files: src/ops.c, src/testdir/test_visual.vim *** ../vim-8.2.3819/src/ops.c 2021-12-12 16:26:35.868627601 +0000 --- src/ops.c 2021-12-15 21:03:36.836377942 +0000 *************** *** 1162,1173 **** n = gchar_cursor(); if (n != NUL) { ! if ((*mb_char2len)(c) > 1 || (*mb_char2len)(n) > 1) { // This is slow, but it handles replacing a single-byte // with a multi-byte and the other way around. if (curwin->w_cursor.lnum == oap->end.lnum) ! oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n); replace_character(c); } else --- 1162,1176 ---- n = gchar_cursor(); if (n != NUL) { ! int new_byte_len = (*mb_char2len)(c); ! int old_byte_len = mb_ptr2len(ml_get_cursor()); ! ! if (new_byte_len > 1 || old_byte_len > 1) { // This is slow, but it handles replacing a single-byte // with a multi-byte and the other way around. if (curwin->w_cursor.lnum == oap->end.lnum) ! oap->end.col += new_byte_len - old_byte_len; replace_character(c); } else *** ../vim-8.2.3819/src/testdir/test_visual.vim 2021-11-17 18:00:28.189010856 +0000 --- src/testdir/test_visual.vim 2021-12-15 20:55:28.047614424 +0000 *************** *** 234,239 **** --- 234,243 ---- call assert_equal("\txaaaa", getline(1)) set softtabstop& + call setline(1, "xã̳x") + normal gg0lvrb + call assert_equal("xbx", getline(1)) + enew! set noai bs&vim if exists('save_t_kD') *** ../vim-8.2.3819/src/version.c 2021-12-15 19:46:55.576673105 +0000 --- src/version.c 2021-12-15 21:05:36.603732437 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3820, /**/ -- I wonder how much deeper the ocean would be without sponges. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///