> On Wed, Jul 27, 2022 at 9:02 AM Yegappan Lakshmanan <[email protected]> 
> wrote:
> >
> > Hi,
> >
> > After executing the following set of commands:
> >
> > ----------------------------------------------------------
> > new
> > call setline(1, ["A quick brown fox jumps over the fence"])
> > call prop_type_add("MyProp", #{bufnr: bufnr(), highlight: 'Search'})
> > call prop_add(1, 9, #{type: "MyProp", text: "Hello World", length: 4})
> > call cursor(1, 15)
> > ----------------------------------------------------------
> >
> > I expected the cursor to be positioned at column 15. But the cursor
> > is positioned at column 26.  If you press CTRL-L, then the
> > cursor is moved to a different column.
> >
> 
> I also noticed other problems with virtual text.  For example, with the above
> script, if you place the cursor at the beginning of the line and execute veey,
> then it copies the text "A quick brown fox jumps".

I already mentioned that the current code only has the first step, there
is lots more to do to get it right.  This is complicated, many parts of
the code depend on the relation between buffer text and the actually
displayed text.

Nevertheless, the idea of using text properties, defining the position,
how it shifts with the text, highlighting, and how the text is defined,
already give you an idea of how the virtual text can be added.  Main
thing missing is how to position text after the end of the line.  We
probably also want right-aligned somehow (and figure out what to do when
it doesn't fit, might need some alternatives).

And it shows how it differs from concealing, which depends on syntax
highlighting, which can't always be figured out within the line itself,
making it too slow to use in general (which is why wrapping is based on
the text without concealing).

-- 
hundred-and-one symptoms of being an internet addict:
162. You go outside and look for a brightness knob to turn down the sun.

 /// 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/20220727212134.97ADB1C0C6E%40moolenaar.net.

Raspunde prin e-mail lui