To: vim_dev@googlegroups.com Subject: Patch 8.1.2218 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2218 Problem: "gN" is off by one in Visual mode. Solution: Check moving forward. (Christian Brabandt, #5075) Files: src/search.c, src/testdir/test_gn.vim *** ../vim-8.1.2217/src/search.c 2019-10-24 15:23:33.522220529 +0200 --- src/search.c 2019-10-26 14:36:31.415544772 +0200 *************** *** 4677,4683 **** #endif /* FEAT_TEXTOBJ */ /* ! * Check if the pattern is one character long or zero-width. * If move is TRUE, check from the beginning of the buffer, else from position * "cur". * "direction" is FORWARD or BACKWARD. --- 4677,4683 ---- #endif /* FEAT_TEXTOBJ */ /* ! * Check if the pattern is zero-width. * If move is TRUE, check from the beginning of the buffer, else from position * "cur". * "direction" is FORWARD or BACKWARD. *************** *** 4851,4857 **** // put cursor on last character of match curwin->w_cursor = end_pos; ! if (LT_POS(VIsual, end_pos)) dec_cursor(); else if (VIsual_active && LT_POS(curwin->w_cursor, VIsual)) curwin->w_cursor = pos; // put the cursor on the start of the match --- 4851,4857 ---- // put cursor on last character of match curwin->w_cursor = end_pos; ! if (LT_POS(VIsual, end_pos) && forward) dec_cursor(); else if (VIsual_active && LT_POS(curwin->w_cursor, VIsual)) curwin->w_cursor = pos; // put the cursor on the start of the match *** ../vim-8.1.2217/src/testdir/test_gn.vim 2019-10-24 15:23:33.526220516 +0200 --- src/testdir/test_gn.vim 2019-10-26 14:40:37.830597170 +0200 *************** *** 148,153 **** --- 148,158 ---- norm! gg0f7vhhhhgnd call assert_equal(['12348'], getline(1,'$')) sil! %d _ + call setline('.', ['12345678']) + let @/ = '5' + norm! gg0f2vf7gNd + call assert_equal(['1678'], getline(1,'$')) + sil! %d _ set wrapscan&vim endfu *** ../vim-8.1.2217/src/version.c 2019-10-26 12:22:58.712730053 +0200 --- src/version.c 2019-10-26 14:39:09.318942805 +0200 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2218, /**/ -- For humans, honesty is a matter of degree. Engineers are always honest in matters of technology and human relationships. That's why it's a good idea to keep engineers away from customers, romantic interests, and other people who can't handle the truth. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///