Splitting textprops over multiple lines

12 views
Skip to first unread message

Axel Forsman

unread,
Feb 22, 2020, 4:14:43 AM2/22/20
to vim...@googlegroups.com
Hello community:

While trying out the new cool text properties feature, one thing puzzled me:
Any attempts at, in insert mode or whatever, splitting a continuous
text property over multiple lines
actually created new ones, instead of extending the one that was already there.

For example, if '#' represents a textprop, with

Lorem ###|### ipsum

with the cursor being *inside* the textprop,
typing '<CR><CR><Up>...' produces:

Lorem ###
...|
### ipsum

where the `...` in not in the textprop.
This is contrary to what I would expect -
that editing inside a textprop should never break into into two.

I also found it really non-obvious how one would go about
programmatically performing an edit to the buffer text and
have the textprops react in the intuitive way like if the edit was
done manually.

Is there any chance this could get fixed, or at least add a note in
the doc for why it works this way?
I do not really see when the existing behavior would be desirable,
and it does complicate my efforts to create a snippet plugin.


Well met,

Axel Forsman

Bram Moolenaar

unread,
Feb 22, 2020, 9:02:10 AM2/22/20
to vim...@googlegroups.com, Axel Forsman

Axel Forsman wrote:

> While trying out the new cool text properties feature, one thing puzzled me:
> Any attempts at, in insert mode or whatever, splitting a continuous
> text property over multiple lines
> actually created new ones, instead of extending the one that was already there.
>
> For example, if '#' represents a textprop, with
>
> Lorem ###|### ipsum
>
> with the cursor being *inside* the textprop,
> typing '<CR><CR><Up>...' produces:
>
> Lorem ###
> ...|
> ### ipsum
>
> where the `...` in not in the textprop.
> This is contrary to what I would expect -
> that editing inside a textprop should never break into into two.

Right, this part was never fully implemented. You are the first to
remark about it. It should be possible to make this work, it requires
someone taking the time to dive into it.

> I also found it really non-obvious how one would go about
> programmatically performing an edit to the buffer text and
> have the textprops react in the intuitive way like if the edit was
> done manually.
>
> Is there any chance this could get fixed, or at least add a note in
> the doc for why it works this way?
> I do not really see when the existing behavior would be desirable,
> and it does complicate my efforts to create a snippet plugin.

--
From "know your smileys":
:-| :-| Deja' vu!

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages