Mercurial > vim
comparison src/memline.c @ 18763:49b78d6465e5 v8.1.2371
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Commit: https://github.com/vim/vim/commit/05ad5ff0ab34ed9a5296dedd420ca81698b8ce22
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 30 22:48:27 2019 +0100
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Problem: FEAT_TEXT_PROP is a confusing name.
Solution: Use FEAT_PROP_POPUP. (Naruhiko Nishino, closes https://github.com/vim/vim/issues/5291)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Nov 2019 23:00:05 +0100 |
parents | 9e6d5a4abb1c |
children | f41b55f9357c |
comparison
equal
deleted
inserted
replaced
18762:19582783e5ad | 18763:49b78d6465e5 |
---|---|
2703 ml_line_alloced(void) | 2703 ml_line_alloced(void) |
2704 { | 2704 { |
2705 return (curbuf->b_ml.ml_flags & ML_LINE_DIRTY); | 2705 return (curbuf->b_ml.ml_flags & ML_LINE_DIRTY); |
2706 } | 2706 } |
2707 | 2707 |
2708 #ifdef FEAT_TEXT_PROP | 2708 #ifdef FEAT_PROP_POPUP |
2709 static void | 2709 static void |
2710 add_text_props_for_append( | 2710 add_text_props_for_append( |
2711 buf_T *buf, | 2711 buf_T *buf, |
2712 linenr_T lnum, | 2712 linenr_T lnum, |
2713 char_u **line, | 2713 char_u **line, |
2787 bhdr_T *hp; | 2787 bhdr_T *hp; |
2788 memfile_T *mfp; | 2788 memfile_T *mfp; |
2789 DATA_BL *dp; | 2789 DATA_BL *dp; |
2790 PTR_BL *pp; | 2790 PTR_BL *pp; |
2791 infoptr_T *ip; | 2791 infoptr_T *ip; |
2792 #ifdef FEAT_TEXT_PROP | 2792 #ifdef FEAT_PROP_POPUP |
2793 char_u *tofree = NULL; | 2793 char_u *tofree = NULL; |
2794 #endif | 2794 #endif |
2795 int ret = FAIL; | 2795 int ret = FAIL; |
2796 | 2796 |
2797 if (lnum > buf->b_ml.ml_line_count || buf->b_ml.ml_mfp == NULL) | 2797 if (lnum > buf->b_ml.ml_line_count || buf->b_ml.ml_mfp == NULL) |
2801 lowest_marked = lnum + 1; | 2801 lowest_marked = lnum + 1; |
2802 | 2802 |
2803 if (len == 0) | 2803 if (len == 0) |
2804 len = (colnr_T)STRLEN(line) + 1; // space needed for the text | 2804 len = (colnr_T)STRLEN(line) + 1; // space needed for the text |
2805 | 2805 |
2806 #ifdef FEAT_TEXT_PROP | 2806 #ifdef FEAT_PROP_POPUP |
2807 if (curbuf->b_has_textprop && lnum > 0) | 2807 if (curbuf->b_has_textprop && lnum > 0) |
2808 // Add text properties that continue from the previous line. | 2808 // Add text properties that continue from the previous line. |
2809 add_text_props_for_append(buf, lnum, &line, &len, &tofree); | 2809 add_text_props_for_append(buf, lnum, &line, &len, &tofree); |
2810 #endif | 2810 #endif |
2811 | 2811 |
3278 channel_write_new_lines(buf); | 3278 channel_write_new_lines(buf); |
3279 #endif | 3279 #endif |
3280 ret = OK; | 3280 ret = OK; |
3281 | 3281 |
3282 theend: | 3282 theend: |
3283 #ifdef FEAT_TEXT_PROP | 3283 #ifdef FEAT_PROP_POPUP |
3284 vim_free(tofree); | 3284 vim_free(tofree); |
3285 #endif | 3285 #endif |
3286 return ret; | 3286 return ret; |
3287 } | 3287 } |
3288 | 3288 |
3407 if (!has_props) | 3407 if (!has_props) |
3408 ++len; // include the NUL after the text | 3408 ++len; // include the NUL after the text |
3409 if (copy) | 3409 if (copy) |
3410 { | 3410 { |
3411 // copy the line to allocated memory | 3411 // copy the line to allocated memory |
3412 #ifdef FEAT_TEXT_PROP | 3412 #ifdef FEAT_PROP_POPUP |
3413 if (has_props) | 3413 if (has_props) |
3414 line = vim_memsave(line, len); | 3414 line = vim_memsave(line, len); |
3415 else | 3415 else |
3416 #endif | 3416 #endif |
3417 line = vim_strnsave(line, len - 1); | 3417 line = vim_strnsave(line, len - 1); |
3430 { | 3430 { |
3431 // another line is buffered, flush it | 3431 // another line is buffered, flush it |
3432 ml_flush_line(curbuf); | 3432 ml_flush_line(curbuf); |
3433 curbuf->b_ml.ml_flags &= ~ML_LINE_DIRTY; | 3433 curbuf->b_ml.ml_flags &= ~ML_LINE_DIRTY; |
3434 | 3434 |
3435 #ifdef FEAT_TEXT_PROP | 3435 #ifdef FEAT_PROP_POPUP |
3436 if (curbuf->b_has_textprop && !has_props) | 3436 if (curbuf->b_has_textprop && !has_props) |
3437 // Need to fetch the old line to copy over any text properties. | 3437 // Need to fetch the old line to copy over any text properties. |
3438 ml_get_buf(curbuf, lnum, TRUE); | 3438 ml_get_buf(curbuf, lnum, TRUE); |
3439 #endif | 3439 #endif |
3440 } | 3440 } |
3441 | 3441 |
3442 #ifdef FEAT_TEXT_PROP | 3442 #ifdef FEAT_PROP_POPUP |
3443 if (curbuf->b_has_textprop && !has_props) | 3443 if (curbuf->b_has_textprop && !has_props) |
3444 { | 3444 { |
3445 size_t oldtextlen = STRLEN(curbuf->b_ml.ml_line_ptr) + 1; | 3445 size_t oldtextlen = STRLEN(curbuf->b_ml.ml_line_ptr) + 1; |
3446 | 3446 |
3447 if (oldtextlen < (size_t)curbuf->b_ml.ml_line_len) | 3447 if (oldtextlen < (size_t)curbuf->b_ml.ml_line_len) |
3473 curbuf->b_ml.ml_flags = (curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY; | 3473 curbuf->b_ml.ml_flags = (curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY; |
3474 | 3474 |
3475 return OK; | 3475 return OK; |
3476 } | 3476 } |
3477 | 3477 |
3478 #ifdef FEAT_TEXT_PROP | 3478 #ifdef FEAT_PROP_POPUP |
3479 /* | 3479 /* |
3480 * Adjust text properties in line "lnum" for a deleted line. | 3480 * Adjust text properties in line "lnum" for a deleted line. |
3481 * When "above" is true this is the line above the deleted line. | 3481 * When "above" is true this is the line above the deleted line. |
3482 * "del_props" are the properties of the deleted line. | 3482 * "del_props" are the properties of the deleted line. |
3483 */ | 3483 */ |
3612 int text_start; | 3612 int text_start; |
3613 int line_start; | 3613 int line_start; |
3614 long line_size; | 3614 long line_size; |
3615 int i; | 3615 int i; |
3616 int ret = FAIL; | 3616 int ret = FAIL; |
3617 #ifdef FEAT_TEXT_PROP | 3617 #ifdef FEAT_PROP_POPUP |
3618 char_u *textprop_save = NULL; | 3618 char_u *textprop_save = NULL; |
3619 int textprop_save_len; | 3619 int textprop_save_len; |
3620 #endif | 3620 #endif |
3621 | 3621 |
3622 if (lowest_marked && lowest_marked > lnum) | 3622 if (lowest_marked && lowest_marked > lnum) |
3669 | 3669 |
3670 #ifdef FEAT_NETBEANS_INTG | 3670 #ifdef FEAT_NETBEANS_INTG |
3671 if (netbeans_active()) | 3671 if (netbeans_active()) |
3672 netbeans_removed(buf, lnum, 0, (long)line_size); | 3672 netbeans_removed(buf, lnum, 0, (long)line_size); |
3673 #endif | 3673 #endif |
3674 #ifdef FEAT_TEXT_PROP | 3674 #ifdef FEAT_PROP_POPUP |
3675 // If there are text properties, make a copy, so that we can update | 3675 // If there are text properties, make a copy, so that we can update |
3676 // properties in preceding and following lines. | 3676 // properties in preceding and following lines. |
3677 if (buf->b_has_textprop) | 3677 if (buf->b_has_textprop) |
3678 { | 3678 { |
3679 size_t textlen = STRLEN((char_u *)dp + line_start) + 1; | 3679 size_t textlen = STRLEN((char_u *)dp + line_start) + 1; |
3770 ml_updatechunk(buf, lnum, line_size, ML_CHNK_DELLINE); | 3770 ml_updatechunk(buf, lnum, line_size, ML_CHNK_DELLINE); |
3771 #endif | 3771 #endif |
3772 ret = OK; | 3772 ret = OK; |
3773 | 3773 |
3774 theend: | 3774 theend: |
3775 #ifdef FEAT_TEXT_PROP | 3775 #ifdef FEAT_PROP_POPUP |
3776 if (textprop_save != NULL) | 3776 if (textprop_save != NULL) |
3777 { | 3777 { |
3778 // Adjust text properties in the line above and below. | 3778 // Adjust text properties in the line above and below. |
3779 if (lnum > 1) | 3779 if (lnum > 1) |
3780 adjust_text_props_for_delete(buf, lnum - 1, textprop_save, textprop_save_len, TRUE); | 3780 adjust_text_props_for_delete(buf, lnum - 1, textprop_save, textprop_save_len, TRUE); |
5557 else | 5557 else |
5558 { | 5558 { |
5559 end_idx = count - 1; | 5559 end_idx = count - 1; |
5560 linecnt += rest; | 5560 linecnt += rest; |
5561 } | 5561 } |
5562 #ifdef FEAT_TEXT_PROP | 5562 #ifdef FEAT_PROP_POPUP |
5563 if (buf->b_has_textprop) | 5563 if (buf->b_has_textprop) |
5564 { | 5564 { |
5565 int i; | 5565 int i; |
5566 | 5566 |
5567 // We cannot use the text pointers to get the text length, | 5567 // We cannot use the text pointers to get the text length, |
5766 break; | 5766 break; |
5767 } | 5767 } |
5768 idx++; | 5768 idx++; |
5769 } | 5769 } |
5770 } | 5770 } |
5771 #ifdef FEAT_TEXT_PROP | 5771 #ifdef FEAT_PROP_POPUP |
5772 if (buf->b_has_textprop) | 5772 if (buf->b_has_textprop) |
5773 { | 5773 { |
5774 int i; | 5774 int i; |
5775 | 5775 |
5776 // cannot use the db_index pointer, need to get the actual text | 5776 // cannot use the db_index pointer, need to get the actual text |