Am 14.05.2012 20:21, schrieb Christian Brabandt:
Bram,
On Mo, 14 Mai 2012, Sergey Khorev wrote:
Can someone write a clean statement of the problem (the file
contents and the commands that led to the behaviour that was
unexpected). Just the facts, without opinions on Vim or users.

This is how I managed to reproduce. Create a file:
----------- snip -----------
# vim: set fileencoding=cp857:

i
----------- snip -----------

Open it in Vim, edit, then
:set nobackup nowritebackup
:w!

Get the warning and then check the file got truncated.

Thanks, was hard enough to get this error message working ^^

btw, s/warning/error/

To make this reproducible, I needed to set fenc=ascii

This patch fixes a data conversion error, that leads to a data loss.
Problem is, that open() is done, even though it is not clear, conversion
will work. So this patch runs buf_write_bytes() twice, first time is to
check that each character can be converted successfully and only if this
does not return, does it really open the file and write the result.

Problem is, this will probably slow down writing speed, as
buf_write_bytes needs to be called twice.

I have tested it with the given sample and it works here.

regards,
Christian

Setting 'writebackup' (enabled per default) indeed protects the file
(except in the temp folder, where 'backupskip' applies).

This option creates temporary files only, thus doesn't waste disk space.

Isn't this safe enough?

Am 13.05.2012 10:10, schrieb Toddintr:
  (Had backups disabled.)

Bad luck ... next time, keep 'writebackup' at the default and all should
be fine.

--
Andy

--
You received this message from the "vim_use" 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

Reply via email to