Comment by neilv

Comment by neilv 3 days ago

10 replies

How would you associate non-character data with ranges of characters, such as for syntax coloring, semantic links, and references to points in the text?

(I couldn't find a mention of this in the README, design.md, or examples.)

In Emacs buffers, the concepts include text properties, overlays, and markers.

filcuk 3 days ago

That would depend on your editor's implementation.

  • neilv 3 days ago

    But, within this API, is there any support for the associations with non-character data?

    For example, if you delete some text these Ropey data structure, does Ropey have facilities to update the associated non-character data (such as deleting all or part of one or more chunks of the non-character data, and/or updating positional information)? Or do you have to do that separately outside of Ropey?

    • zaphar 3 days ago

      A rope is only concerned with manipulating a string with very low cpu overhead while maintaining the illusion of a sequence of characters or bytes. It doesn't really care or maintain any other text decoration you might be maintaining. That is the concern of the consumer of the rope and I'm not sure there is a good common interface for that.

      • neilv 3 days ago

        Thanks.

        I was a little confused, because the lede sentence was "Ropey is a utf8 text rope for Rust, designed to be the backing text-buffer for applications such as text editors."

        Pretty much all text editors are expected to implement decorations and references, somehow, and some popular text buffer APIs support those.

iLemming 3 days ago

I'm sorry, it's only vaguely related, but maybe someone can share some ideas.

What would be some good use-cases for using Ropey with Emacs? Maybe re-formatting/beautifying huge json files or something like that?

I didn't have time yet to explore the project more closely, but it looks very interesting.