To: vim-dev@vim.org Subject: Patch 6.2.200 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.200 Problem: When recovering a file, 'fileformat' is always the default, thus writing the file may result in differences. (Penelope Fudd) Solution: Before recovering the file try reading the original file to obtain the values of 'fileformat', 'fileencoding', etc. Files: src/memline.c *** ../vim-6.2.199/src/memline.c Sun May 25 17:26:29 2003 --- src/memline.c Wed Jan 21 10:31:41 2004 *************** *** 932,937 **** --- 932,949 ---- while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) ml_delete((linenr_T)1, FALSE); + /* + * Try reading the original file to obtain the values of 'fileformat', + * 'fileencoding', etc. Ignore errors. The text itself is not used. + */ + if (curbuf->b_ffname != NULL) + { + (void)readfile(curbuf->b_ffname, NULL, (linenr_T)0, + (linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW); + while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) + ml_delete((linenr_T)1, FALSE); + } + bnum = 1; /* start with block 1 */ page_count = 1; /* which is 1 page */ lnum = 0; /* append after line 0 in curbuf */ *** ../vim-6.2.199/src/version.c Sun Jan 25 19:40:26 2004 --- src/version.c Sun Jan 25 19:44:09 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 200, /**/ -- SIGIRO -- irony detected (iron core dumped) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///