39 releases (12 stable)

2.0.0-alpha.2 Oct 21, 2024
1.6.1 Oct 18, 2023
1.6.0 Feb 1, 2023
1.5.1-alpha Nov 28, 2022
0.2.0 Mar 3, 2015

#8 in Text processing

Download history 11615/week @ 2024-07-15 13724/week @ 2024-07-22 14044/week @ 2024-07-29 13350/week @ 2024-08-05 13875/week @ 2024-08-12 13674/week @ 2024-08-19 12958/week @ 2024-08-26 13785/week @ 2024-09-02 13375/week @ 2024-09-09 13178/week @ 2024-09-16 14049/week @ 2024-09-23 11468/week @ 2024-09-30 11048/week @ 2024-10-07 14120/week @ 2024-10-14 14653/week @ 2024-10-21 12849/week @ 2024-10-28

54,216 downloads per month
Used in 196 crates (88 directly)

MIT/Apache

370KB
7.5K SLoC

Ropey 2 (alpha)

This is the WIP next major version of Ropey. DO NOT USE THIS for serious work. This is alpha software, meaning both that the API is not fully stable yet and that it is likely pretty buggy.

Trying it out, kicking its tires, and providing feedback is welcome, however.

Differences from Ropey 1.x

There are many breaking API changes in Ropey 2.x. However, the major ones are:

  • Indexing is now byte based rather than char based. For example, text insertion, text removal, and slicing are all done with byte indices now. Even fetching chars is now done by byte index. If you still want or need to work in terms of char indices, you can do so by using the index conversion functions to convert between byte and char indices as needed.
  • The index conversion functions are now byte-to-metric and metric-to-byte rather than metricA-to-metricB. The latter can still be accomplished by using byte indices as an intermediate.
  • The chunk fetching API's have been stripped down. For example, there are no longer chunk_at_line(), etc. functions for fetching chunks based on arbitrary indexing metrics, instead being replaced by just chunk_at() which fetches using only byte indices. Fetching based on arbitrary metrics can still be accomplished by combining chunk_at() with the index conversion functions.
  • All indexing metrics other than byte index are now behind feature flags, and can be enabled or disabled individually as desired. Of those, only LF-CR lines are enabled by default. Notably, this means that the char indexing metric is not enabled by default.
  • The line metric feature flags are now properly additive, and multiple line indexing metrics can be tracked simultaneously. Because of this, all line-based APIs now take a LineType parameter that specifies which of the available metrics to use.

What does this mean for Ropey 1.x?

Ropey 1.x will continue to be maintained for the foreseeable future, but will no longer receive new features. Ropey 1.x is still a good, high-quality rope library that can be depended on, and you don't need to move to Ropey 2.x if 1.x serves your needs.

If at some point maintenance of Ropey 1.x stops, it will be with plenty of advance warning to ensure that everyone has ample time to migrate.

License

This project is licensed under either of

at your option.

Contributing

Bug reports and API feedback based on testing Ropey 2 are very welcome.

Code contributions are NOT currently welcome from anyone outside of the dev team. All PRs, no matter how good, no matter how seemingly obvious or minor, even if they helpfully fix a reported bug or other issue, will be rejected without review.

Ropey 2 will become open to code contributions once it's out of alpha.

Dependencies