To: vim_dev@googlegroups.com Subject: Patch 8.1.2072 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2072 Problem: "gk" moves to start of line instead of upwards. Solution: Fix off-by-one error. (Christian Brabandt, closes #4969) Files: src/normal.c, src/testdir/test_normal.vim *** ../vim-8.1.2071/src/normal.c 2019-09-21 20:46:14.728275744 +0200 --- src/normal.c 2019-09-24 22:44:35.690996099 +0200 *************** *** 3406,3413 **** { if (dir == BACKWARD) { ! if ((long)curwin->w_curswant >= width2) ! /* move back within line */ curwin->w_curswant -= width2; else { --- 3406,3413 ---- { if (dir == BACKWARD) { ! if ((long)curwin->w_curswant > width2) ! // move back within line curwin->w_curswant -= width2; else { *** ../vim-8.1.2071/src/testdir/test_normal.vim 2019-08-14 21:12:00.977833219 +0200 --- src/testdir/test_normal.vim 2019-09-24 22:42:54.739490058 +0200 *************** *** 2633,2635 **** --- 2633,2657 ---- call assert_equal('100 foobar foobar fo', getreg(0)) bw! endfunc + + func Test_normal_gk() + " needs 80 column new window + new + vert 80new + put =[repeat('x',90)..' {{{1', 'x {{{1'] + norm! gk + " In a 80 column wide terminal the window will be only 78 char + " (because Vim will leave space for the other window), + " but if the terminal is larger, it will be 80 chars, so verify the + " cursor column correctly. + call assert_equal(winwidth(0)+1, col('.')) + call assert_equal(winwidth(0)+1, virtcol('.')) + norm! j + call assert_equal(6, col('.')) + call assert_equal(6, virtcol('.')) + norm! gk + call assert_equal(95, col('.')) + call assert_equal(95, virtcol('.')) + bw! + bw! + endfunc *** ../vim-8.1.2071/src/version.c 2019-09-23 22:17:11.763604665 +0200 --- src/version.c 2019-09-24 22:44:12.715107870 +0200 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 2072, /**/ -- PRINCE: He's come to rescue me, father. LAUNCELOT: (embarrassed) Well, let's not jump to conclusions ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///