Skip to content

Why does trailing newline not count as a line? #20

@QnnOkabayashi

Description

@QnnOkabayashi

Hi! This crate is amazing, thank you for your work on it.

I'm curious what the motivation is for having the empty line after a trailing newline not be counted as a line? For context, I'm creating a language server, and when I open an empty document and start writing, the first incremental update I get is roughly "insert X text on line 0". But rope.line(0) on an empty rope just panics, when I would expect it to return an empty RopeSlice.

Is this an outcome of the implementation? Or was Rope created with a specific use case in mind that wanted this behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions