Ticket #1595 (closed defect: fixed)

Opened 15 years ago

Last modified 15 years ago

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

Reported by: slyfox Owned by: angel_il
Priority: major Milestone: 4.7.0-pre3
Component: mcview Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: Votes for changeset: committed-master

Description

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

Change History

comment:1 Changed 15 years ago by angel_il

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

comment:2 Changed 15 years ago by angel_il

  • severity changed from no branch to on review

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

comment:3 Changed 15 years ago by slyfox

  • 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.

comment:4 follow-up: ↓ 7 Changed 15 years ago by 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?

comment:5 Changed 15 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:6 Changed 15 years ago by andrew_b

  • Votes for changeset changed from slavazanko to slavazanko andrew_b
  • severity changed from on rework to approved

comment:7 in reply to: ↑ 4 Changed 15 years ago by slyfox

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

comment:8 Changed 15 years ago by angel_il

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

comment:9 Changed 15 years ago by angel_il

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

comment:10 Changed 15 years ago by angel_il

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.