To: vim-dev@vim.org Subject: Patch 6.1.053 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.053 Problem: When 'sessionoptions' contains "globals", or "localoptions" and an option value contains a line break, the resulting script is wrong. Solution: Use "\n" and "\r" for a line break. (Srinath Avadhanula) Files: src/eval.c *** ../vim61.052/src/eval.c Sun Apr 21 15:46:47 2002 --- src/eval.c Sun Apr 28 18:09:17 2002 *************** *** 8547,8553 **** garray_T *gap = &variables; /* global variable */ VAR this_var; int i; ! char_u *p; for (i = gap->ga_len; --i >= 0; ) { --- 8547,8553 ---- garray_T *gap = &variables; /* global variable */ VAR this_var; int i; ! char_u *p, *t; for (i = gap->ga_len; --i >= 0; ) { *************** *** 8556,8563 **** { if (var_flavour(this_var->var_name) == VAR_FLAVOUR_SESSION) { p = vim_strsave_escaped(get_var_string(this_var), ! (char_u *)"\\\""); if ((fprintf(fd, "let %s = %c%s%c", this_var->var_name, (this_var->var_type == VAR_STRING) ? '"' : ' ', --- 8556,8572 ---- { if (var_flavour(this_var->var_name) == VAR_FLAVOUR_SESSION) { + /* Escapse special characters with a backslash. Turn a LF and + * CR into \n and \r. */ p = vim_strsave_escaped(get_var_string(this_var), ! (char_u *)"\\\"\n\r"); ! if (p == NULL) /* out of memory */ ! continue; ! for (t = p; *t != NUL; ++t) ! if (*t == '\n') ! *t = 'n'; ! else if (*t == '\r') ! *t = 'r'; if ((fprintf(fd, "let %s = %c%s%c", this_var->var_name, (this_var->var_type == VAR_STRING) ? '"' : ' ', *** ../vim61.052/src/version.c Sun May 5 14:35:03 2002 --- src/version.c Sun May 5 19:02:50 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 53, /**/ -- A law to reduce crime states: "It is mandatory for a motorist with criminal intentions to stop at the city limits and telephone the chief of police as he is entering the town. [real standing law in Washington, United States of America] /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///