To: vim_dev@googlegroups.com Subject: Patch 9.0.0166 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0166 Problem: When using text properties the line text length is computed twice. Solution: If the text lenght was already computed don't do it again. Files: src/memline.c *** ../vim-9.0.0165/src/memline.c 2022-06-30 22:13:56.204846337 +0100 --- src/memline.c 2022-08-07 21:47:12.892984870 +0100 *************** *** 2821,2826 **** --- 2821,2829 ---- infoptr_T *ip; #ifdef FEAT_PROP_POPUP char_u *tofree = NULL; + # ifdef FEAT_BYTEOFF + colnr_T text_len = 0; // text len with NUL without text properties + # endif #endif int ret = FAIL; *************** *** 2831,2837 **** --- 2834,2852 ---- lowest_marked = lnum + 1; if (len == 0) + { len = (colnr_T)STRLEN(line) + 1; // space needed for the text + #if defined(FEAT_PROP_POPUP) && defined(FEAT_BYTEOFF) + text_len = len; + #endif + } + #if defined(FEAT_PROP_POPUP) && defined(FEAT_BYTEOFF) + else if (curbuf->b_has_textprop) + // "len" may include text properties, get the length of the text. + text_len = (colnr_T)STRLEN(line) + 1; + else + text_len = len; + #endif #ifdef FEAT_PROP_POPUP if (curbuf->b_has_textprop && lnum > 0 *************** *** 3292,3304 **** } #ifdef FEAT_BYTEOFF - # ifdef FEAT_PROP_POPUP - if (curbuf->b_has_textprop) - // only use the space needed for the text, ignore properties - len = (colnr_T)STRLEN(line) + 1; - # endif // The line was inserted below 'lnum' ! ml_updatechunk(buf, lnum + 1, (long)len, ML_CHNK_ADDLINE); #endif #ifdef FEAT_NETBEANS_INTG --- 3307,3320 ---- } #ifdef FEAT_BYTEOFF // The line was inserted below 'lnum' ! ml_updatechunk(buf, lnum + 1, ! # ifdef FEAT_PROP_POPUP ! (long)text_len ! # else ! (long)len ! #endif ! , ML_CHNK_ADDLINE); #endif #ifdef FEAT_NETBEANS_INTG *** ../vim-9.0.0165/src/version.c 2022-08-07 18:20:03.212214747 +0100 --- src/version.c 2022-08-07 21:39:26.794126958 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 166, /**/ -- hundred-and-one symptoms of being an internet addict: 271. You collect hilarious signatures from all 250 mailing lists you are subscribed to. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///