To: vim_dev@googlegroups.com Subject: Patch 9.0.0358 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0358 Problem: 'breakindent' does not indent non-lists with "breakindentopt=list:-1". Solution: Adjust indent computation. (Maxim Kim, closes #11038) Files: src/indent.c, src/testdir/test_breakindent.vim *** ../vim-9.0.0357/src/indent.c 2022-08-15 16:29:34.024877526 +0100 --- src/indent.c 2022-09-02 14:05:23.342297354 +0100 *************** *** 998,1004 **** if (wp->w_briopt_list > 0) prev_list = wp->w_briopt_list; else ! prev_list = (*regmatch.endp - *regmatch.startp); } vim_regfree(regmatch.regprog); } --- 998,1004 ---- if (wp->w_briopt_list > 0) prev_list = wp->w_briopt_list; else ! prev_indent = (*regmatch.endp - *regmatch.startp); } vim_regfree(regmatch.regprog); } *************** *** 1017,1029 **** bri += win_col_off2(wp); // add additional indent for numbered lists ! if (wp->w_briopt_list != 0) ! { ! if (wp->w_briopt_list > 0) ! bri += prev_list; ! else ! bri = prev_list; ! } // indent minus the length of the showbreak string if (wp->w_briopt_sbr) --- 1017,1024 ---- bri += win_col_off2(wp); // add additional indent for numbered lists ! if (wp->w_briopt_list > 0) ! bri += prev_list; // indent minus the length of the showbreak string if (wp->w_briopt_sbr) *** ../vim-9.0.0357/src/testdir/test_breakindent.vim 2022-07-01 13:15:31.556075437 +0100 --- src/testdir/test_breakindent.vim 2022-09-02 14:05:23.342297354 +0100 *************** *** 818,824 **** " check formatlistpat indent with different list level " showbreak and sbr ! setl briopt=min:5,sbr,list:-1,shift:2 setl showbreak=> redraw! let expect = [ --- 818,824 ---- " check formatlistpat indent with different list level " showbreak and sbr ! setl briopt=min:5,sbr,list:-1 setl showbreak=> redraw! let expect = [ *************** *** 831,836 **** --- 831,874 ---- \ ] let lines = s:screen_lines2(1, 6, 20) call s:compare_lines(expect, lines) + + " check formatlistpat indent with different list level + " showbreak sbr and shift + setl briopt=min:5,sbr,list:-1,shift:2 + setl showbreak=> + redraw! + let expect = [ + \ "* Congress shall ", + \ "> make no law ", + \ "*** Congress shall ", + \ "> make no law ", + \ "**** Congress shall ", + \ "> make no law ", + \ ] + let lines = s:screen_lines2(1, 6, 20) + call s:compare_lines(expect, lines) + + " check breakindent works if breakindentopt=list:-1 + " for a non list content + %delete _ + call setline(1, [' Congress shall make no law', + \ ' Congress shall make no law', + \ ' Congress shall make no law']) + norm! 1gg + setl briopt=min:5,list:-1 + setl showbreak= + redraw! + let expect = [ + \ " Congress shall ", + \ " make no law ", + \ " Congress shall ", + \ " make no law ", + \ " Congress shall ", + \ " make no law ", + \ ] + let lines = s:screen_lines2(1, 6, 20) + call s:compare_lines(expect, lines) + call s:close_windows('set breakindent& briopt& linebreak& list& listchars& showbreak&') endfunc *** ../vim-9.0.0357/src/version.c 2022-09-02 13:26:03.852450821 +0100 --- src/version.c 2022-09-02 14:07:47.017946632 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 358, /**/ -- Scientists decoded the first message from an alien civilization: SIMPLY SEND 6 TIMES 10 TO THE 50 ATOMS OF HYDROGEN TO THE STAR SYSTEM AT THE TOP OF THE LIST, CROSS OFF THAT STAR SYSTEM, THEN PUT YOUR STAR SYSTEM AT THE BOTTOM OF THE LIST AND SEND IT TO 100 OTHER STAR SYSTEMS. WITHIN ONE TENTH GALACTIC ROTATION YOU WILL RECEIVE ENOUGH HYDROGREN TO POWER YOUR CIVILIZATION UNTIL ENTROPY REACHES ITS MAXIMUM! IT REALLY WORKS! /// 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 ///