Yegappan wrote:
> > > On Fri, Aug 13, 2021 at 8:49 AM Bram Moolenaar <[email protected]> wrote: > > > > > > > > > > > > > On Fri, Aug 13, 2021 at 5:18 AM bfrg <[email protected]> > > > > > wrote: > > > > > > > > > > > > I find it awkward that multiline text-properties cannot be handled > > > > > > with this function. > > > > > > Is there really such a drastic slowdown when the function is > > > > > > changed to > > > > > > prop_add_list({props}, [[{lnum}, {col}, {end-lnum}, {end-col}], > > > > > > ...])? > > > > > > > > > > > > > > > > Adding one more item to the List will not slow down the function. > > > > > The user now needs to pass a four item List instead of a three item > > > > > List. If the common case is single line text properties, then in most > > > > > use cases, lnum and end-lnum will be the same. > > > > > > > > > > Based on Bram's comment, I thought if multi-line text property is > > > > > needed, > > > > > then prop_add() should be used? > > > > > > > > Even though it's very likely that prop_add_list() will only be used for > > > > single line items, and one can always fall back to calling prop_add() > > > > multiple times, there is the argument of what users expect. It's a bit > > > > of a surprise if something is left out for unclear reasons. Especially > > > > when adding it doesn't really have a negative effect. > > > > > > > > So we could make it [lnum, col, end_lnum, end_col]. Since this would be > > > > filled in by a script, setting end_lnum equal to lnum won't be much > > > > hassle, right? > > > > > > > > > > I have updated the PR with the support for specifying the end line number. > > > > > > Should we also support specifying multiple text properties in a single > > > call? > > > > > > prop_add_list([[{prop1}, [<locations]], [{prop2}, [<locations>]], ....]) > > > > That adds more dictionaries, which is less efficient and results in a > > mix of types, which is more complicated. I think we should stick to > > using one {props} argument that applies to the list of locations. > > If we really need more, we could add another function. > > > > I think I didn't provide a clear description. I meant, to add multiple > text properties in several locations, instead of calling the > prop_add_list() function multiple times (one for each text property > and a list of locations), we can change the prop_add_list() function > to accept a single List. In this List, each item is a List with the text > property {prop} and a list of locations. This can help in reducing > the number of calls to prop_add_list(). I understand. This is starting to look a lot like a sequence of calls to prop_add(). That takes away lot of the "added value" of the function. The idea is to add properties with the same attributes in a list of positions, thus avoiding to list the properties multiple times. Potential users of this function: Please comment. -- If "R" is Reverse, how come "D" is FORWARD? /// 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/202108141201.17EC1cU03731222%40masaka.moolenaar.net.
