Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viewer: exceeding newline on '\r\n' terminator #1595

Closed
mc-butler opened this issue Sep 9, 2009 · 11 comments
Closed

viewer: exceeding newline on '\r\n' terminator #1595

mc-butler opened this issue Sep 9, 2009 · 11 comments
Labels
area: mcview mcview, the built-in text editor prio: medium Has the potential to affect progress
Milestone

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/1595
Reporter slyfox (@trofi)

Steps to reproduce:
$ printf "1\r\n2\r\n" > /tmp/foo.txt
$ mcview /tmp/foo.txt # ugh, stupious newline between 1 and 2
$ mcedit /tmp/foo.txt # normal mode

4.7.0-pre2-29-g5a8923e

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Sep 19, 2009 at 10:07 UTC (comment 1)

  • Owner set to angel_il
  • Status changed from new to accepted

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Sep 22, 2009 at 13:51 UTC (comment 2)

  • Severity changed from no branch to on review

branch: 1595_newline (parent: master)
changeset: [0d6b5b48c9b01015a02c2878c8bf499a3a5574ae]

@mc-butler
Copy link
Author

Changed by slyfox (@trofi) on Sep 22, 2009 at 14:08 UTC (comment 3)

  • Severity changed from on review to on rework

Fix does not seem to work on pattern, like this:

printf "1\r\n2\r\n3\r4\n\r5\r"

At least newline count mismatches between viewer/editor: 3<->4 and 4<->5 look weird.

I'm not sure what we expect to see on MacOSX.

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Sep 22, 2009 at 17:02 UTC (comment 4)

hypothesis: '\n', '\r\n' and '\r' is a <EOL>

1\r\n2\r\n3\r4\n\r5\r

will be transformed in

1 <EOL>
2 <EOL>
3 <EOL>
4 <EOL>
<EOL>
5 <EOL>

what's wrong?

@mc-butler
Copy link
Author

Changed by slavazanko (@slavaz) on Sep 23, 2009 at 6:44 UTC (comment 5)

  • Votes set to slavazanko

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 23, 2009 at 6:52 UTC (comment 6)

  • Severity changed from on rework to approved
  • Votes changed from slavazanko to slavazanko andrew_b

@mc-butler
Copy link
Author

Changed by slyfox (@trofi) on Sep 23, 2009 at 7:15 UTC (comment 4.7)

Replying to angel_il:

hypothesis: '\n', '\r\n' and '\r' is a <EOL>

1\r\n2\r\n3\r4\n\r5\r

will be transformed in

1 <EOL>
2 <EOL>
3 <EOL>
4 <EOL>
<EOL>
5 <EOL>

what's wrong?> hypothesis: '\n', '\r\n' and '\r' is a <EOL>

1\r\n2\r\n3\r4\n\r5\r

will be transformed in

1 <EOL>
2 <EOL>
3 <EOL>
4 <EOL>
<EOL>
5 <EOL>

what's wrong?

It's inconsistent with _our_ editor:
editor:

1^M
2^M
3^M4     # no newline!
^M5^M    #single newline

As you see '\r' is not treated as newline, i'm just curious why viewer should screw it up?

viewer from branch:

1
2
3
4        # whoops
         # whoops again
5

BTW, as we try to view/edit foreign files we mignt need choice where file did come from:
http://en.wikipedia.org/wiki/Newline

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Sep 23, 2009 at 7:49 UTC (comment 8)

slyfox

1
2
3
4        # whoops
         # whoops again
5

because '\r', \r\n, \n is the end of line.
\n\r - not is the EOL

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Sep 23, 2009 at 12:17 UTC (comment 9)

  • Severity changed from approved to merged
  • Status changed from accepted to testing
  • Resolution set to fixed
  • Votes changed from slavazanko andrew_b to commited-master

Fixed: [cd27ee2]

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Sep 23, 2009 at 12:21 UTC (comment 10)

  • Status changed from testing to closed

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Feb 21, 2025 at 7:18 UTC (comment 11)

Ticket #1626 has been marked as a duplicate of this ticket.

@mc-butler mc-butler marked this as a duplicate of #1626 Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: mcview mcview, the built-in text editor prio: medium Has the potential to affect progress
Development

No branches or pull requests

1 participant