To: vim-dev@vim.org Subject: Patch 6.2.452 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.452 Problem: In diff mode, when DiffAdd and DiffText highlight settings are equal, an added line is highlighted with DiffChange. (Tom Schumm) Solution: Remember the diff highlight type instead of the attributes. Files: src/screen.c *** ../vim-6.2.451/src/screen.c Mon Apr 5 20:28:39 2004 --- src/screen.c Mon Apr 5 21:17:58 2004 *************** *** 2508,2514 **** #ifdef FEAT_DIFF int filler_lines; /* nr of filler lines to be drawn */ int filler_todo; /* nr of filler lines still to do + 1 */ ! int diff_attr = 0; /* attributes for changed/added line */ int change_start = MAXCOL; /* first col of changed area */ int change_end = -1; /* last col of changed area */ #endif --- 2508,2514 ---- #ifdef FEAT_DIFF int filler_lines; /* nr of filler lines to be drawn */ int filler_todo; /* nr of filler lines still to do + 1 */ ! enum hlf_value diff_hlf = (enum hlf_value)0; /* type of diff highlighting */ int change_start = MAXCOL; /* first col of changed area */ int change_end = -1; /* last col of changed area */ #endif *************** *** 2718,2731 **** if (filler_lines == -1) { if (diff_find_change(wp, lnum, &change_start, &change_end)) ! diff_attr = hl_attr(HLF_ADD); /* added line */ else if (change_start == 0) ! diff_attr = hl_attr(HLF_TXD); /* changed text */ else ! diff_attr = hl_attr(HLF_CHD); /* changed line */ } else ! diff_attr = hl_attr(HLF_ADD); /* added line */ filler_lines = 0; area_highlighting = TRUE; } --- 2718,2731 ---- if (filler_lines == -1) { if (diff_find_change(wp, lnum, &change_start, &change_end)) ! diff_hlf = HLF_ADD; /* added line */ else if (change_start == 0) ! diff_hlf = HLF_TXD; /* changed text */ else ! diff_hlf = HLF_CHD; /* changed line */ } else ! diff_hlf = HLF_ADD; /* added line */ filler_lines = 0; area_highlighting = TRUE; } *************** *** 3230,3249 **** char_attr = search_attr; #ifdef FEAT_DIFF ! if (diff_attr != 0 && n_extra == 0) { ! if (diff_attr == hl_attr(HLF_CHD) && ptr - line >= change_start) ! diff_attr = hl_attr(HLF_TXD); /* changed text */ ! if (diff_attr == hl_attr(HLF_TXD) && ptr - line > change_end) ! diff_attr = hl_attr(HLF_CHD); /* changed line */ if (attr == 0 || area_attr != attr) ! area_attr = diff_attr; if (attr == 0 || char_attr != attr) { if (search_attr != 0) char_attr = search_attr; else ! char_attr = diff_attr; } } #endif --- 3230,3249 ---- char_attr = search_attr; #ifdef FEAT_DIFF ! if (diff_hlf != (enum hlf_value)0 && n_extra == 0) { ! if (diff_hlf == HLF_CHD && ptr - line >= change_start) ! diff_hlf = HLF_TXD; /* changed text */ ! if (diff_hlf == HLF_TXD && ptr - line > change_end) ! diff_hlf = HLF_CHD; /* changed line */ if (attr == 0 || area_attr != attr) ! area_attr = hl_attr(diff_hlf); if (attr == 0 || char_attr != attr) { if (search_attr != 0) char_attr = search_attr; else ! char_attr = hl_attr(diff_hlf); } } #endif *************** *** 3627,3633 **** * "$". */ if ( # ifdef FEAT_DIFF ! diff_attr == 0 # ifdef LINE_ATTR && # endif --- 3627,3633 ---- * "$". */ if ( # ifdef FEAT_DIFF ! diff_hlf == (enum hlf_value)0 # ifdef LINE_ATTR && # endif *************** *** 3711,3717 **** #if defined(FEAT_DIFF) || defined(LINE_ATTR) else if (( # ifdef FEAT_DIFF ! diff_attr != 0 # ifdef LINE_ATTR || # endif --- 3711,3717 ---- #if defined(FEAT_DIFF) || defined(LINE_ATTR) else if (( # ifdef FEAT_DIFF ! diff_hlf != (enum hlf_value)0 # ifdef LINE_ATTR || # endif *************** *** 3725,3735 **** c = ' '; --ptr; /* put it back at the NUL */ # ifdef FEAT_DIFF ! if (diff_attr == hl_attr(HLF_TXD)) { ! diff_attr = hl_attr(HLF_CHD); if (attr == 0 || char_attr != attr) ! char_attr = diff_attr; } # endif } --- 3725,3735 ---- c = ' '; --ptr; /* put it back at the NUL */ # ifdef FEAT_DIFF ! if (diff_hlf == HLF_TXD) { ! diff_hlf = HLF_CHD; if (attr == 0 || char_attr != attr) ! char_attr = hl_attr(diff_hlf); } # endif } *** ../vim-6.2.451/src/version.c Mon Apr 5 20:28:39 2004 --- src/version.c Mon Apr 5 21:05:14 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 452, /**/ -- Life would be so much easier if we could just look at the source code. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///