Patch 8.2.2890
Problem:    Text property duplicated when data block splits.
Solution:   Do not continue text prop from previous line. (closes #8261)
Files:      src/memline.c, src/structs.h, src/testdir/test_textprop.vim


*** ../vim-8.2.2889/src/memline.c       2021-03-10 21:55:42.729459602 +0100
--- src/memline.c       2021-05-26 22:30:32.078297122 +0200
***************
*** 2772,2778 ****
        len = (colnr_T)STRLEN(line) + 1;        // space needed for the text
  
  #ifdef FEAT_PROP_POPUP
!     if (curbuf->b_has_textprop && lnum > 0 && !(flags & ML_APPEND_UNDO))
        // Add text properties that continue from the previous line.
        add_text_props_for_append(buf, lnum, &line, &len, &tofree);
  #endif
--- 2772,2779 ----
        len = (colnr_T)STRLEN(line) + 1;        // space needed for the text
  
  #ifdef FEAT_PROP_POPUP
!     if (curbuf->b_has_textprop && lnum > 0
!                            && !(flags & (ML_APPEND_UNDO | ML_APPEND_NOPROP)))
        // Add text properties that continue from the previous line.
        add_text_props_for_append(buf, lnum, &line, &len, &tofree);
  #endif
***************
*** 3992,3998 ****
                 */
                // How about handling errors???
                (void)ml_append_int(buf, lnum, new_line, new_len,
!                        (dp->db_index[idx] & DB_MARKED) ? ML_APPEND_MARK : 0);
                (void)ml_delete_int(buf, lnum, 0);
            }
        }
--- 3993,4003 ----
                 */
                // How about handling errors???
                (void)ml_append_int(buf, lnum, new_line, new_len,
!                        ((dp->db_index[idx] & DB_MARKED) ? ML_APPEND_MARK : 0)
! #ifdef FEAT_PROP_POPUP
!                            | ML_APPEND_NOPROP
! #endif
!                        );
                (void)ml_delete_int(buf, lnum, 0);
            }
        }
*** ../vim-8.2.2889/src/structs.h       2021-05-18 15:09:13.963782700 +0200
--- src/structs.h       2021-05-26 22:25:14.575089741 +0200
***************
*** 774,779 ****
--- 774,780 ----
  #define ML_APPEND_NEW     1   // starting to edit a new file
  #define ML_APPEND_MARK            2   // mark the new line
  #define ML_APPEND_UNDO            4   // called from undo
+ #define ML_APPEND_NOPROP    8 // do not continue textprop from previous line
  
  
  /*
*** ../vim-8.2.2889/src/testdir/test_textprop.vim       2021-03-27 
22:07:21.529728904 +0100
--- src/testdir/test_textprop.vim       2021-05-26 22:29:54.498389573 +0200
***************
*** 1469,1473 ****
--- 1469,1492 ----
    bwipe!
  endfunc
  
+ " This was calling ml_append_int() and copy a text property from a previous
+ " line at the wrong moment.  Exact text length matters.
+ def Test_prop_splits_data_block()
+   new
+   var lines: list<string> = [repeat('x', 35)]->repeat(41)
+                       + [repeat('!', 35)]
+                       + [repeat('x', 35)]->repeat(56)
+   lines->setline(1)
+   prop_type_add('someprop', {highlight: 'ErrorMsg'})
+   prop_add(1, 27, {end_lnum: 1, end_col: 70, type: 'someprop'})
+   prop_remove({type: 'someprop'}, 1)
+   prop_add(35, 22, {end_lnum: 43, end_col: 43, type: 'someprop'})
+   prop_remove({type: 'someprop'}, 35, 43)
+   assert_equal([], prop_list(42))
+ 
+   bwipe!
+   prop_type_delete('someprop')
+ enddef
+ 
  
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2889/src/version.c       2021-05-26 21:49:15.132267291 +0200
--- src/version.c       2021-05-26 22:30:43.710268568 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2890,
  /**/

-- 
-rwxr-xr-x  1 root          24 Oct 29  1929 /bin/ed
-rwxr-xr-t  4 root      131720 Jan  1  1970 /usr/ucb/vi
-rwxr-xr-x  1 root  5.89824e37 Oct 22  1990 /usr/bin/emacs

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202105262032.14QKWa6q811183%40masaka.moolenaar.net.

Raspunde prin e-mail lui