Skip to content

Extra newline character to last line. #258

Open

Description

@AlexanderWangY

Expected:

> printf "a\nb\nc" | sed -n 'x;x;p;p'
> a
> a
> b
> b
> c
> cterm@term > 

Note how c has no newline at the end and the terminal prompt becomes one with it.

Observed

> printf "a\nb\nc" | cargo run -p sed -- -n 'x;x;p;p'
> a
> a
> b
> b
> c
> c
> term@term:

The last c is newline terminated even without needing it. I believe the issue is due to the chomp when printing in processor.rs on the p pattern match. Basically, if its not newline terminated, we manually add a newline, however this should not apply to the last line (is that correct?)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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