Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 77 by [email protected]: [patch] Non-empty file without EOL markers should use default fileformat instead of mac.
http://code.google.com/p/vim/issues/detail?id=77

What steps will reproduce the problem?
1. echo -n oneline > oneline.txt
2. echo "ffs=unix,dos,mac" >> ~/.vimrc
3. vim oneline.txt
4. set ff?

What is the expected output? What do you see instead?
Expected: "  fileformat=unix"
Currently: "  fileformat=mac"

On Windows, with ffs=dos,unix,mac instead, I expect to see " fileformat=dos" but still see " fileformat=mac".

What version of the product are you using? On what operating system?

Verified with version 7.3.154+hg~74503f6ee649-2ubuntu3.1 from Ubuntu, and with v7-3-608 built from the hg repository, on Ubuntu 11.10 Oneiric Ocelot.

Please provide any additional information below.

The three patches included each solve the problem, but in slightly different ways; choose only one. The -minimal patch includes just enough to fix this issue, without affecting anything else.

The -rewrite and -macpref patches, on the other hand, rewrite the scanning logic to use at most one scan and to repair a related issue where mac would be preferred over unix for long dos-format files when ff=unix,mac and the <CR><NL> pair gets split up by the buffer boundary. The difference between the two patches is whether mac or dos is preferred when there are more <CR><NL> pairs than bare carriage returns. However, both now prefer mac over dos when there are more bare carriage returns than <CR><NL> pairs, which is a change from the current version; they can probably be modified to remove even that difference, though.

Attachments:
        single-line-fileformat-minimal.diff  1.7 KB
        single-line-fileformat-macpref.diff  4.3 KB
        single-line-fileformat-rewrite.diff  4.5 KB

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui