From 0a8e6115901032c36f9b0a5e7d2d7dd689f0e74a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 9 Oct 2010 17:23:31 +0200 Subject: [PATCH 1/8] updated for version 7.3.020 Problem: Cursor position wrong when joining multiple lines and 'formatoptions' contains "a". (Moshe Kamensky) Solution: Adjust cursor position for skipped indent. (Carlo Teubner) --- src/ops.c | 9 +++++---- src/testdir/test68.in | 11 +++++++++++ src/testdir/test68.ok | 3 +++ src/version.c | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/ops.c b/src/ops.c index 98bd2d171a..cf5d1b13c1 100644 --- a/src/ops.c +++ b/src/ops.c @@ -4153,9 +4153,10 @@ do_join(count, insert_space, save_undo) int save_undo; { char_u *curr = NULL; + char_u *curr_start = NULL; char_u *cend; char_u *newp; - char_u *spaces; /* number of spaces inserte before a line */ + char_u *spaces; /* number of spaces inserted before a line */ int endcurr1 = NUL; int endcurr2 = NUL; int currsize = 0; /* size of the current line */ @@ -4181,7 +4182,7 @@ do_join(count, insert_space, save_undo) */ for (t = 0; t < count; ++t) { - curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t)); + curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t)); if (insert_space && t > 0) { curr = skipwhite(curr); @@ -4265,10 +4266,10 @@ do_join(count, insert_space, save_undo) copy_spaces(cend, (size_t)(spaces[t])); } mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t, - (long)(cend - newp + spaces[t])); + (long)(cend - newp + spaces[t] - (curr - curr_start))); if (t == 0) break; - curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1)); + curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1)); if (insert_space && t > 1) curr = skipwhite(curr); currsize = (int)STRLEN(curr); diff --git a/src/testdir/test68.in b/src/testdir/test68.in index 94104c07bd..8d0c501e2a 100644 --- a/src/testdir/test68.in +++ b/src/testdir/test68.in @@ -50,6 +50,17 @@ a b #a b } +STARTTEST +/^{/+2 +:set tw& fo=a +I^^ +ENDTEST + +{ + 1aa + 2bb +} + STARTTEST :g/^STARTTEST/.,/^ENDTEST/d :1;/^Results/,$wq! test.out diff --git a/src/testdir/test68.ok b/src/testdir/test68.ok index 85f35cfca1..aebe364363 100644 --- a/src/testdir/test68.ok +++ b/src/testdir/test68.ok @@ -33,3 +33,6 @@ a b #a b } + +{ 1aa ^^2bb } + diff --git a/src/version.c b/src/version.c index 38a081352c..6d19c82cdb 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 20, /**/ 19, /**/ From eb3ed243d9b816578ea72fe56c3a176cd6bc3496 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 10 Oct 2010 17:08:43 +0200 Subject: [PATCH 2/8] updated for version 7.3.021 Problem: Conflict for defining Boolean in Mac header files. Solution: Define NO_X11_INCLUDES. (Rainer Muller) --- src/os_macosx.m | 4 ++++ src/version.c | 2 ++ src/vim.h | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/os_macosx.m b/src/os_macosx.m index 4ad8d26a80..1d88e7dcd6 100644 --- a/src/os_macosx.m +++ b/src/os_macosx.m @@ -15,6 +15,10 @@ Error: MACOS 9 is no longer supported in Vim 7 #endif +/* Avoid a conflict for the definition of Boolean between Mac header files and + * X11 header files. */ +#define NO_X11_INCLUDES + #include "vim.h" #import diff --git a/src/version.c b/src/version.c index 6d19c82cdb..46e278d53b 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 21, /**/ 20, /**/ diff --git a/src/vim.h b/src/vim.h index b9ce325539..6c846c1d7e 100644 --- a/src/vim.h +++ b/src/vim.h @@ -192,8 +192,8 @@ #endif #ifdef NO_X11_INCLUDES - /* In os_mac_conv.c NO_X11_INCLUDES is defined to avoid X11 headers. - * Disable all X11 related things to avoid conflicts. */ + /* In os_mac_conv.c and os_macosx.m NO_X11_INCLUDES is defined to avoid + * X11 headers. Disable all X11 related things to avoid conflicts. */ # ifdef FEAT_X11 # undef FEAT_X11 # endif From b5f9dd7b3fbeac29f8499443094cfd5564ace5b3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Oct 2010 14:05:35 +0200 Subject: [PATCH 3/8] updated for version 7.3.022 Problem: When opening a new window the 'spellcapcheck' option is cleared. Solution: Copy the correct option value. (Christian Brabandt) --- src/option.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/option.c b/src/option.c index b137fa4530..47537fa808 100644 --- a/src/option.c +++ b/src/option.c @@ -10011,7 +10011,7 @@ buf_copy_options(buf, flags) buf->b_p_smc = p_smc; #endif #ifdef FEAT_SPELL - buf->b_s.b_p_spc = vim_strsave(p_spf); + buf->b_s.b_p_spc = vim_strsave(p_spc); (void)compile_cap_prog(&buf->b_s); buf->b_s.b_p_spf = vim_strsave(p_spf); buf->b_s.b_p_spl = vim_strsave(p_spl); diff --git a/src/version.c b/src/version.c index 46e278d53b..9db3fce9f9 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 22, /**/ 21, /**/ From a112c4958910bb3128d92f45acb59e4e824342f3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Oct 2010 16:22:09 +0200 Subject: [PATCH 4/8] updated for version 7.3.023 Problem: External program may hang when it tries to write to the tty. Solution: Don't close the slave tty until after the child exits. (Nikola Knezevic) --- src/os_unix.c | 9 ++++++++- src/version.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/os_unix.c b/src/os_unix.c index b0e0f02119..150bdad6d8 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4168,7 +4168,6 @@ mch_call_shell(cmd, options) # ifdef FEAT_GUI if (pty_master_fd >= 0) { - close(pty_slave_fd); /* close slave side of pty */ fromshell_fd = pty_master_fd; toshell_fd = dup(pty_master_fd); } @@ -4637,6 +4636,14 @@ finished: break; } +# ifdef FEAT_GUI + /* Close slave side of pty. Only do this after the child has + * exited, otherwise the child may hang when it tries to write on + * the pty. */ + if (pty_master_fd >= 0) + close(pty_slave_fd); +# endif + /* Make sure the child that writes to the external program is * dead. */ if (wpid > 0) diff --git a/src/version.c b/src/version.c index 9db3fce9f9..6b7742e97e 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 23, /**/ 22, /**/ From 0a7cafb2c8689324416239271b6b261769f89609 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Oct 2010 16:44:23 +0200 Subject: [PATCH 5/8] updated for version 7.3.024 Problem: Named signs do not use a negative number as intended. Solution: Fix the numbering of named signs. (Xavier de Gaye) --- src/ex_cmds.c | 19 +++++++++++-------- src/version.c | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index d53652fda2..e8b39b3c8f 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -6670,11 +6670,6 @@ ex_sign(eap) sp = (sign_T *)alloc_clear((unsigned)sizeof(sign_T)); if (sp == NULL) return; - if (sp_prev == NULL) - first_sign = sp; - else - sp_prev->sn_next = sp; - sp->sn_name = vim_strnsave(arg, (int)(p - arg)); /* If the name is a number use that for the typenr, * otherwise use a negative number. */ @@ -6687,13 +6682,14 @@ ex_sign(eap) for (lp = first_sign; lp != NULL; lp = lp->sn_next) { - if (lp->sn_typenr == last_sign_typenr) + if (lp->sn_typenr == -last_sign_typenr) { --last_sign_typenr; if (last_sign_typenr == 0) last_sign_typenr = MAX_TYPENR; if (last_sign_typenr == start) { + vim_free(sp); EMSG(_("E612: Too many signs defined")); return; } @@ -6702,10 +6698,17 @@ ex_sign(eap) } } - sp->sn_typenr = last_sign_typenr--; - if (last_sign_typenr == 0) + sp->sn_typenr = -last_sign_typenr; + if (--last_sign_typenr == 0) last_sign_typenr = MAX_TYPENR; /* wrap around */ } + + /* add the new sign to the list of signs */ + if (sp_prev == NULL) + first_sign = sp; + else + sp_prev->sn_next = sp; + sp->sn_name = vim_strnsave(arg, (int)(p - arg)); } /* set values for a defined sign. */ diff --git a/src/version.c b/src/version.c index 6b7742e97e..882f9a14ec 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 24, /**/ 23, /**/ From 801135edc8723b4b936af814a4077f895928cacd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Oct 2010 17:50:07 +0200 Subject: [PATCH 6/8] updated for version 7.3.025 Problem: ":mksession" does not square brackets escape file name properly. Solution: Improve escapging of file names. (partly by Peter Odding) --- src/ex_docmd.c | 59 ++++++++++++++++++-------------------------------- src/version.c | 2 ++ 2 files changed, 23 insertions(+), 38 deletions(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 0940ad8625..fe1bfe7497 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -10708,7 +10708,7 @@ ses_fname(fd, buf, flagp) * Write a file name to the session file. * Takes care of the "slash" option in 'sessionoptions' and escapes special * characters. - * Returns FAIL if writing fails. + * Returns FAIL if writing fails or out of memory. */ static int ses_put_fname(fd, name, flagp) @@ -10717,49 +10717,32 @@ ses_put_fname(fd, name, flagp) unsigned *flagp; { char_u *sname; + char_u *p; int retval = OK; - int c; sname = home_replace_save(NULL, name); - if (sname != NULL) - name = sname; - while (*name != NUL) - { -#ifdef FEAT_MBYTE - { - int l; + if (sname == NULL) + return FAIL; - if (has_mbyte && (l = (*mb_ptr2len)(name)) > 1) - { - /* copy a multibyte char */ - while (--l >= 0) - { - if (putc(*name, fd) != *name) - retval = FAIL; - ++name; - } - continue; - } - } -#endif - c = *name++; - if (c == '\\' && (*flagp & SSOP_SLASH)) - /* change a backslash to a forward slash */ - c = '/'; - else if ((vim_strchr(escape_chars, c) != NULL -#ifdef BACKSLASH_IN_FILENAME - && c != '\\' -#endif - ) || c == '#' || c == '%') - { - /* escape a special character with a backslash */ - if (putc('\\', fd) != '\\') - retval = FAIL; - } - if (putc(c, fd) != c) - retval = FAIL; + if (*flagp & SSOP_SLASH) + { + /* change all backslashes to forward slashes */ + for (p = sname; *p != NUL; mb_ptr_adv(p)) + if (*p == '\\') + *p = '/'; } + + /* escapse special characters */ + p = vim_strsave_fnameescape(sname, FALSE); vim_free(sname); + if (p == NULL) + return FAIL; + + /* write the result */ + if (fputs((char *)p, fd) < 0) + retval = FAIL; + + vim_free(p); return retval; } diff --git a/src/version.c b/src/version.c index 882f9a14ec..9959c79d3a 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 25, /**/ 24, /**/ From a95ebf0fcd28b86d5905bc60db78563e74d719b4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Oct 2010 18:06:47 +0200 Subject: [PATCH 7/8] updated for version 7.3.026 Problem: CTRL-] in a help file doesn't always work. (Tony Mechelynck) Solution: Don't escape special characters. (Carlo Teubner) --- src/normal.c | 9 +++++++-- src/version.c | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/normal.c b/src/normal.c index b76e40d1de..1754e8aa08 100644 --- a/src/normal.c +++ b/src/normal.c @@ -5666,8 +5666,13 @@ nv_ident(cap) else if (cmdchar == '#') aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\"); else if (tag_cmd) - /* Don't escape spaces and Tabs in a tag with a backslash */ - aux_ptr = (char_u *)"\\|\"\n["; + { + if (curbuf->b_help) + /* ":help" handles unescaped argument */ + aux_ptr = (char_u *)""; + else + aux_ptr = (char_u *)"\\|\"\n["; + } else aux_ptr = (char_u *)"\\|\"\n*?["; diff --git a/src/version.c b/src/version.c index 9959c79d3a..bedc601c84 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 26, /**/ 25, /**/ From 4758cc5fb2196ace1b7d1c18b50815008feffcb6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Oct 2010 20:37:41 +0200 Subject: [PATCH 8/8] updated for version 7.3.027 Problem: Opening a file on a network share is very slow. Solution: When fixing file name case append "\*" to directory, server and network share names. (David Anderson, John Beckett) --- src/os_win32.c | 11 ++++++++++- src/version.c | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/os_win32.c b/src/os_win32.c index 8c59e09967..6bfcc2af52 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2308,12 +2308,14 @@ fname_case( int len) { char szTrueName[_MAX_PATH + 2]; + char szTrueNameTemp[_MAX_PATH + 2]; char *ptrue, *ptruePrev; char *porig, *porigPrev; int flen; WIN32_FIND_DATA fb; HANDLE hFind; int c; + int slen; flen = (int)STRLEN(name); if (flen == 0 || flen > _MAX_PATH) @@ -2358,12 +2360,19 @@ fname_case( } *ptrue = NUL; + /* To avoid a slow failure append "\*" when searching a directory, + * server or network share. */ + STRCPY(szTrueNameTemp, szTrueName); + slen = strlen(szTrueNameTemp); + if (*porig == psepc && slen + 2 < _MAX_PATH) + STRCPY(szTrueNameTemp + slen, "\\*"); + /* Skip "", "." and "..". */ if (ptrue > ptruePrev && (ptruePrev[0] != '.' || (ptruePrev[1] != NUL && (ptruePrev[1] != '.' || ptruePrev[2] != NUL))) - && (hFind = FindFirstFile(szTrueName, &fb)) + && (hFind = FindFirstFile(szTrueNameTemp, &fb)) != INVALID_HANDLE_VALUE) { c = *porig; diff --git a/src/version.c b/src/version.c index bedc601c84..dde80faee9 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 27, /**/ 26, /**/