On Do, 29 Nov 2018, Bram Moolenaar wrote:

> 
> Christian wrote:
> 
> > On Mi, 28 Nov 2018, Bram Moolenaar wrote:
> > 
> > > This is the result of the poll for features needed for supporting plugins.
> > > These functions are to be added to support highlighting text, as defined
> > > with text properties and text property types.
> > > 
> > > A text property type defines the highlighting and further attributes for
> > > a kind of text property, such as the priority.
> > > 
> > > A text property defines the position where a text property type applies.
> > > Text properties can overlap, the one with the highest priority will be
> > > used for the highlighting.  Text properties move with the text when
> > > changes are made.
> > > 
> > > Although both syntax highlighting and text properties can be active at
> > > the same time, normally only one of them would be present in a buffer.
> > > In case they do both exist, text properties overrule syntax
> > > highlighting.
> > > 
> > > 
> > > Please have a look at this and give feedback before I finish a first
> > > implementation.
> > 
> > I thought this could be used for the requested virtual_text_feature, but 
> > that does not seem to be possible from the given description, rather it 
> > seems to be just another kind of highlighting feature.
> 
> What virtual_text_feature?

I thought it was mentioned here before, but apparently not. It's a kind 
of concealing on steroids:
https://github.com/vim/vim/issues/3573#issuecomment-438147714
https://github.com/neovim/neovim/blob/master/runtime/doc/api.txt#L1168-L1204
> 
> > Text property also makes it sound, as one could attach a kind of 
> > text-local variable with certain parts of the content, but that does not 
> > seem to be possible either.
> 
> Yes you can, but not directly to the text property, since that is nearly
> impossible to implement (or very inefficient).  You would need to
> associate an ID with a variable, e.g. in a dictionary.  Or associate a
> property type to a variable, which is more efficient.
> 
>       let propdict = {}
>       let funcstart_id = 123
>       let propdict[funcstart_id: 'funcstart']
>       call prop_add(222, 1, {'id': funcstart_id})
> 
> Instead of the 'funcstart' string you could use anything.
> 
> The main purpose is to avoid adding pointers in the stored text, since
> they will become invalid and cause crashes.  Garbage collection would
> also become very inefficient.

I see. However, please make a function that will automatically generate 
a new id, so that plugins can make sure not to use an already used id 
(in other words, please let's not make the same error again that was 
made with the signs).

> > So what exactly is the advantage of using text properties and not syntax 
> > highlighting or the matchadd() functionality? 
> 
> When redrawing the screen the text properties define the highlighting,
> no need to run all the pattern matching for syntax highlighting.  It
> should be several orders of magnitude faster.  Making it possible to
> sync the highlighting from the start and updating it asynchronously.

Sounds interestingly. Is that supposed to be an alternative for syntax 
highlighting, e.g. something like this: 
https://github.com/vim/vim/issues/3573#issuecomment-433705754

e.g. provide an alternative means for faster syntax highlighting, that 
does not depend on possible slow regexpes? Would that allow for syntax 
plugins that use the property feature then?

> > Does it affect only the current window in which the buffer is displayed, 
> > or all windows?
> 
> Since the properties are stored with the text they are related to the
> buffer.  Doing this per-window is not possible. Although, perhaps the
> property types could be defined per window.  That's quite a bit more
> complicated, is it worth it?

Probably not, just trying to understand the new proposed feature and it 
was not obvious on reading the document.

> Yes.  Inserting/deleting lines will be automatically handled, since the
> properties are stored with the text.  For inserting/deleting characters
> inside the line, adjusting the column and length, will be quite a bit of
> work, but it is needed.  Adjusting the column of marks is a long
> standing feature request.

That would be nice however.


Best,
Christian
-- 
Ein schlechtes Gewissen haben immer die anderen Leute.

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui