mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.2.3062: internal error when adding several text properties
Problem: Internal error when adding several text properties. Solution: Do not handle text properties when deleting a line for splitting a data block. (closes #8466)
This commit is contained in:
@@ -3662,7 +3662,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int flags)
|
|||||||
#ifdef FEAT_PROP_POPUP
|
#ifdef FEAT_PROP_POPUP
|
||||||
// If there are text properties, make a copy, so that we can update
|
// If there are text properties, make a copy, so that we can update
|
||||||
// properties in preceding and following lines.
|
// properties in preceding and following lines.
|
||||||
if (buf->b_has_textprop && !(flags & ML_DEL_UNDO))
|
if (buf->b_has_textprop && !(flags & (ML_DEL_UNDO | ML_DEL_NOPROP)))
|
||||||
{
|
{
|
||||||
size_t textlen = STRLEN((char_u *)dp + line_start) + 1;
|
size_t textlen = STRLEN((char_u *)dp + line_start) + 1;
|
||||||
|
|
||||||
@@ -3765,9 +3765,11 @@ theend:
|
|||||||
{
|
{
|
||||||
// Adjust text properties in the line above and below.
|
// Adjust text properties in the line above and below.
|
||||||
if (lnum > 1)
|
if (lnum > 1)
|
||||||
adjust_text_props_for_delete(buf, lnum - 1, textprop_save, textprop_save_len, TRUE);
|
adjust_text_props_for_delete(buf, lnum - 1, textprop_save,
|
||||||
|
textprop_save_len, TRUE);
|
||||||
if (lnum <= buf->b_ml.ml_line_count)
|
if (lnum <= buf->b_ml.ml_line_count)
|
||||||
adjust_text_props_for_delete(buf, lnum, textprop_save, textprop_save_len, FALSE);
|
adjust_text_props_for_delete(buf, lnum, textprop_save,
|
||||||
|
textprop_save_len, FALSE);
|
||||||
}
|
}
|
||||||
vim_free(textprop_save);
|
vim_free(textprop_save);
|
||||||
#endif
|
#endif
|
||||||
@@ -4021,7 +4023,7 @@ ml_flush_line(buf_T *buf)
|
|||||||
| ML_APPEND_NOPROP
|
| ML_APPEND_NOPROP
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
(void)ml_delete_int(buf, lnum, 0);
|
(void)ml_delete_int(buf, lnum, ML_DEL_NOPROP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vim_free(new_line);
|
vim_free(new_line);
|
||||||
|
@@ -769,6 +769,7 @@ typedef struct memline
|
|||||||
// Values for the flags argument of ml_delete_flags().
|
// Values for the flags argument of ml_delete_flags().
|
||||||
#define ML_DEL_MESSAGE 1 // may give a "No lines in buffer" message
|
#define ML_DEL_MESSAGE 1 // may give a "No lines in buffer" message
|
||||||
#define ML_DEL_UNDO 2 // called from undo, do not update textprops
|
#define ML_DEL_UNDO 2 // called from undo, do not update textprops
|
||||||
|
#define ML_DEL_NOPROP 4 // splitting data block, do not update textprops
|
||||||
|
|
||||||
// Values for the flags argument of ml_append_int().
|
// Values for the flags argument of ml_append_int().
|
||||||
#define ML_APPEND_NEW 1 // starting to edit a new file
|
#define ML_APPEND_NEW 1 // starting to edit a new file
|
||||||
|
@@ -1488,5 +1488,27 @@ def Test_prop_splits_data_block()
|
|||||||
prop_type_delete('someprop')
|
prop_type_delete('someprop')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
" This was calling ml_delete_int() and try to change text properties.
|
||||||
|
def Test_prop_add_delete_line()
|
||||||
|
new
|
||||||
|
var a = 10
|
||||||
|
var b = 20
|
||||||
|
repeat([''], a)->append('$')
|
||||||
|
prop_type_add('Test', {highlight: 'ErrorMsg'})
|
||||||
|
for lnum in range(1, a)
|
||||||
|
for col in range(1, b)
|
||||||
|
prop_add(1, 1, {end_lnum: lnum, end_col: col, type: 'Test'})
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
|
||||||
|
# check deleting lines is OK
|
||||||
|
:5del
|
||||||
|
:1del
|
||||||
|
:$del
|
||||||
|
|
||||||
|
prop_type_delete('Test')
|
||||||
|
bwipe!
|
||||||
|
enddef
|
||||||
|
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3062,
|
||||||
/**/
|
/**/
|
||||||
3061,
|
3061,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user