Patch 9.0.0167
Problem:    Checking for text properties could be a bit more efficient.
Solution:   Return early when there are no text properties.  Update TODO
            items.
Files:      src/textprop.c


*** ../vim-9.0.0166/src/textprop.c      2022-08-07 18:20:03.212214747 +0100
--- src/textprop.c      2022-08-07 22:02:40.139824541 +0100
***************
*** 11,22 ****
   * Text properties implementation.  See ":help text-properties".
   *
   * TODO:
-  * - Checking the text length to detect text properties is slow.  Use a flag 
in
-  *   the index, like DB_MARKED?
   * - Also test line2byte() with many lines, so that ml_updatechunk() is taken
   *   into account.
-  * - Perhaps have a window-local option to disable highlighting from text
-  *   properties?
   */
  
  #include "vim.h"
--- 11,18 ----
***************
*** 579,591 ****
      text = ml_get_buf(buf, lnum, will_change);
      textlen = STRLEN(text) + 1;
      proplen = buf->b_ml.ml_line_len - textlen;
      if (proplen % sizeof(textprop_T) != 0)
      {
        iemsg(_(e_text_property_info_corrupted));
        return 0;
      }
!     if (proplen > 0)
!       *props = text + textlen;
      return (int)(proplen / sizeof(textprop_T));
  }
  
--- 575,588 ----
      text = ml_get_buf(buf, lnum, will_change);
      textlen = STRLEN(text) + 1;
      proplen = buf->b_ml.ml_line_len - textlen;
+     if (proplen == 0)
+       return 0;
      if (proplen % sizeof(textprop_T) != 0)
      {
        iemsg(_(e_text_property_info_corrupted));
        return 0;
      }
!     *props = text + textlen;
      return (int)(proplen / sizeof(textprop_T));
  }
  
*** ../vim-9.0.0166/src/version.c       2022-08-07 21:48:33.600845564 +0100
--- src/version.c       2022-08-07 22:04:22.867728999 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     167,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
10E. You start counting in hex.

 /// 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/20220807210546.AC05D1C0EC3%40moolenaar.net.

Raspunde prin e-mail lui