Patch 8.2.3270
Problem:    prop_find() finds property with ID -2.
Solution:   Use a separate flag to indicate an ID was specified. (issue #8674)
Files:      src/textprop.c


*** ../vim-8.2.3269/src/textprop.c      2021-07-31 18:33:53.180698143 +0200
--- src/textprop.c      2021-08-01 19:24:24.483791616 +0200
***************
*** 623,629 ****
      int               lnum_start;
      int               start_pos_has_prop = 0;
      int               seen_end = 0;
!     int               id = -1;
      int               type_id = -1;
      int               skipstart = 0;
      int               lnum = -1;
--- 623,630 ----
      int               lnum_start;
      int               start_pos_has_prop = 0;
      int               seen_end = 0;
!     int               id = 0;
!     int               id_found = FALSE;
      int               type_id = -1;
      int               skipstart = 0;
      int               lnum = -1;
***************
*** 688,695 ****
      if (dict_find(dict, (char_u *)"id", -1) != NULL)
      {
        id = dict_get_number(dict, (char_u *)"id");
!       if (id == -1)
!           id = -2;
      }
      if (dict_find(dict, (char_u *)"type", -1))
      {
--- 689,695 ----
      if (dict_find(dict, (char_u *)"id", -1) != NULL)
      {
        id = dict_get_number(dict, (char_u *)"id");
!       id_found = id != 0;
      }
      if (dict_find(dict, (char_u *)"type", -1))
      {
***************
*** 701,712 ****
        type_id = type->pt_id;
      }
      both = dict_get_bool(dict, (char_u *)"both", FALSE);
!     if (id == -1 && type_id == -1)
      {
        emsg(_("E968: Need at least one of 'id' or 'type'"));
        return;
      }
!     if (both && (id == -1 || type_id == -1))
      {
        emsg(_("E860: Need 'id' and 'type' with 'both'"));
        return;
--- 701,712 ----
        type_id = type->pt_id;
      }
      both = dict_get_bool(dict, (char_u *)"both", FALSE);
!     if (!id_found && type_id == -1)
      {
        emsg(_("E968: Need at least one of 'id' or 'type'"));
        return;
      }
!     if (both && (!id_found || type_id == -1))
      {
        emsg(_("E860: Need 'id' and 'type' with 'both'"));
        return;
***************
*** 744,750 ****
                    continue;
            }
            if (both ? prop.tp_id == id && prop.tp_type == type_id
!                    : prop.tp_id == id || prop.tp_type == type_id)
            {
                // Check if the starting position has text props.
                if (lnum_start == lnum
--- 744,751 ----
                    continue;
            }
            if (both ? prop.tp_id == id && prop.tp_type == type_id
!                    : (id_found && prop.tp_id == id)
!                                                   || prop.tp_type == type_id)
            {
                // Check if the starting position has text props.
                if (lnum_start == lnum
*** ../vim-8.2.3269/src/version.c       2021-08-01 15:40:24.648232770 +0200
--- src/version.c       2021-08-01 19:26:07.019450746 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3270,
  /**/

-- 
FATHER: One day, lad, all this will be yours ...
PRINCE: What - the curtains?
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202108011729.171HTmaX305868%40masaka.moolenaar.net.

Raspunde prin e-mail lui