cessen / ropey

A utf8 text rope for manipulating and editing large texts.
MIT License
1.04k stars 46 forks source link

Chars::reversed not working as expected #93

Closed TornaxO7 closed 11 months ago

TornaxO7 commented 11 months ago

Here is the minimal example:

use ropey::Rope;

fn main() {
    let string = Rope::from_str("Hello there!");

    println!("{:?}", string.chars().collect::<String>());
    println!("{:?}", string.chars().reversed().collect::<String>());
}

Output:

"Hello there!"
""

is that expected because I'd expect to get:

"Hello there!"
"!ereht olleH"
pascalkuthe commented 11 months ago

Please read the documentation of the iterator module. Rev and reversed are not the same. Ropey iterators are cursors and not double ended. This is expected behavior.

TornaxO7 commented 11 months ago

oops. Sorry