Mirror of the Vim source from https://github.com/vim/vim
Révision | 336c99d14cc549b2609c73baf34fab7d64bb9e03 (tree) |
---|---|
l'heure | 2022-07-01 21:30:03 |
Auteur | Bram Moolenaar <Bram@vim....> |
Commiter | Bram Moolenaar |
patch 9.0.0016: comparing line pointer for 'breakindent' is not reliable
Commit: https://github.com/vim/vim/commit/c2a79b87fc31080ba24394c0b30bab45f1bea852
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 1 13:15:35 2022 +0100
@@ -924,7 +924,8 @@ | ||
924 | 924 | { |
925 | 925 | static int prev_indent = 0; // cached indent value |
926 | 926 | static long prev_ts = 0L; // cached tabstop value |
927 | - static char_u *prev_line = NULL; // cached pointer to line | |
927 | + static int prev_fnum = 0; // cached buffer number | |
928 | + static char_u *prev_line = NULL; // cached copy of "line" | |
928 | 929 | static varnumber_T prev_tick = 0; // changedtick of cached value |
929 | 930 | # ifdef FEAT_VARTABS |
930 | 931 | static int *prev_vts = NULL; // cached vartabs values |
@@ -941,21 +942,28 @@ | ||
941 | 942 | ? number_width(wp) + 1 : 0); |
942 | 943 | |
943 | 944 | // used cached indent, unless |
944 | - // - line pointer changed | |
945 | + // - buffer changed | |
945 | 946 | // - 'tabstop' changed |
947 | + // - buffer was changed | |
946 | 948 | // - 'briopt_list changed' changed or |
947 | 949 | // - 'formatlistpattern' changed |
948 | - if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts | |
950 | + // - line changed | |
951 | + // - 'vartabs' changed | |
952 | + if (prev_fnum != wp->w_buffer->b_fnum | |
953 | + || prev_ts != wp->w_buffer->b_p_ts | |
949 | 954 | || prev_tick != CHANGEDTICK(wp->w_buffer) |
950 | 955 | || prev_listopt != wp->w_briopt_list |
951 | - || (prev_flp == NULL | |
952 | - || (STRCMP(prev_flp, get_flp_value(wp->w_buffer)) != 0)) | |
956 | + || prev_flp == NULL | |
957 | + || STRCMP(prev_flp, get_flp_value(wp->w_buffer)) != 0 | |
958 | + || prev_line == NULL || STRCMP(prev_line, line) != 0 | |
953 | 959 | # ifdef FEAT_VARTABS |
954 | 960 | || prev_vts != wp->w_buffer->b_p_vts_array |
955 | 961 | # endif |
956 | 962 | ) |
957 | 963 | { |
958 | - prev_line = line; | |
964 | + prev_fnum = wp->w_buffer->b_fnum; | |
965 | + vim_free(prev_line); | |
966 | + prev_line = vim_strsave(line); | |
959 | 967 | prev_ts = wp->w_buffer->b_p_ts; |
960 | 968 | prev_tick = CHANGEDTICK(wp->w_buffer); |
961 | 969 | # ifdef FEAT_VARTABS |
@@ -716,9 +716,6 @@ | ||
716 | 716 | endfunc |
717 | 717 | |
718 | 718 | func Test_breakindent20_list() |
719 | - " FIXME - this should not matter | |
720 | - call test_override('alloc_lines', 0) | |
721 | - | |
722 | 719 | call s:test_windows('setl breakindent breakindentopt= linebreak') |
723 | 720 | " default: |
724 | 721 | call setline(1, [' 1. Congress shall make no law', |
@@ -802,12 +799,12 @@ | ||
802 | 799 | call s:compare_lines(expect, lines) |
803 | 800 | " check formatlistpat indent with different list levels |
804 | 801 | let &l:flp = '^\s*\*\+\s\+' |
805 | - redraw! | |
806 | 802 | %delete _ |
807 | 803 | call setline(1, ['* Congress shall make no law', |
808 | 804 | \ '*** Congress shall make no law', |
809 | 805 | \ '**** Congress shall make no law']) |
810 | 806 | norm! 1gg |
807 | + redraw! | |
811 | 808 | let expect = [ |
812 | 809 | \ "* Congress shall ", |
813 | 810 | \ " make no law ", |
@@ -835,9 +832,6 @@ | ||
835 | 832 | let lines = s:screen_lines2(1, 6, 20) |
836 | 833 | call s:compare_lines(expect, lines) |
837 | 834 | call s:close_windows('set breakindent& briopt& linebreak& list& listchars& showbreak&') |
838 | - | |
839 | - " FIXME - this should not matter | |
840 | - call test_override('alloc_lines', 1) | |
841 | 835 | endfunc |
842 | 836 | |
843 | 837 | " The following used to crash Vim. This is fixed by 8.2.3391. |
@@ -881,9 +875,6 @@ | ||
881 | 875 | endfunc |
882 | 876 | |
883 | 877 | func Test_no_spurious_match() |
884 | - " FIXME - fails under valgrind - this should not matter - timing issue? | |
885 | - call test_override('alloc_lines', 0) | |
886 | - | |
887 | 878 | let s:input = printf('- y %s y %s', repeat('x', 50), repeat('x', 50)) |
888 | 879 | call s:test_windows('setl breakindent breakindentopt=list:-1 formatlistpat=^- hls') |
889 | 880 | let @/ = '\%>3v[y]' |
@@ -893,8 +884,6 @@ | ||
893 | 884 | " cleanup |
894 | 885 | set hls&vim |
895 | 886 | bwipeout! |
896 | - " FIXME - this should not matter | |
897 | - call test_override('alloc_lines', 1) | |
898 | 887 | endfunc |
899 | 888 | |
900 | 889 | func Test_no_extra_indent() |
@@ -736,6 +736,8 @@ | ||
736 | 736 | static int included_patches[] = |
737 | 737 | { /* Add new patch number below this line */ |
738 | 738 | /**/ |
739 | + 16, | |
740 | +/**/ | |
739 | 741 | 15, |
740 | 742 | /**/ |
741 | 743 | 14, |