Skip to content

OffsetPosition lineContents wrongly includes a newline #56

Closed
@inkytonik

Description

@inkytonik

According to the documentation, the lineContents method of a Position should not include a newline, but this code:

def lineContents: String =
    source.subSequence(index(line - 1), index(line)).toString

includes everything from the start of line - 1 to the start of line thereby including the newline at the end of the line.

The effect of this bug is that messages that use Position.longString end up with an undesirable blank line between the contents line and the up arrow line since longString also puts a newline between the two:

LINE CONTENTS

      ^

Presumably the fix is to use index(line) - 1 in the above code instead of index(line) so that the newline is omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions