To: vim_dev@googlegroups.com Subject: Patch 8.2.4563 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4563 Problem: "z=" in Visual mode may go beyond the end of the line. Solution: Adjust "badlen". Files: src/spellsuggest.c, src/testdir/test_spell.vim *** ../vim-8.2.4562/src/spellsuggest.c 2022-02-16 19:24:03.630162410 +0000 --- src/spellsuggest.c 2022-03-13 20:10:41.055141499 +0000 *************** *** 506,511 **** --- 506,515 ---- curwin->w_cursor.col = VIsual.col; ++badlen; end_visual_mode(); + // make sure we don't include the NUL at the end of the line + line = ml_get_curline(); + if (badlen > STRLEN(line) - curwin->w_cursor.col) + badlen = STRLEN(line) - curwin->w_cursor.col; } // Find the start of the badly spelled word. else if (spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL) == 0 *** ../vim-8.2.4562/src/testdir/test_spell.vim 2022-01-29 11:22:11.827641991 +0000 --- src/testdir/test_spell.vim 2022-03-13 20:10:30.559188438 +0000 *************** *** 456,461 **** --- 456,476 ---- call assert_fails('set spellsuggest=timeout:--9', 'E474:') endfunc + func Test_spellsuggest_visual_end_of_line() + let enc_save = &encoding + set encoding=iso8859 + + " This was reading beyond the end of the line. + norm R00000000000 + sil norm 0 + sil! norm i00000) + sil! norm i00000) + call feedkeys("\") + norm z= + + let &encoding = enc_save + endfunc + func Test_spellinfo() new let runtime = substitute($VIMRUNTIME, '\\', '/', 'g') *** ../vim-8.2.4562/src/version.c 2022-03-13 19:23:44.912318213 +0000 --- src/version.c 2022-03-13 20:12:06.214772795 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4563, /**/ -- If VIM were a woman, I'd marry her. Slim, organized, helpful and beautiful; what's not to like? --David A. Rogers /// 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 ///