summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-11-12 19:28:16 +0100
committerBram Moolenaar <Bram@vim.org>2014-11-12 19:28:16 +0100
commit54fb43813443554c685306b92166218c53cdb18f (patch)
tree54c7a04235f7f67785c7815b71aabbdef5a5cbda
parentef6875be7a0b4dde9589e69b0a0229c4b976c45b (diff)
downloadvim-git-7.4.515.tar.gz
updated for version 7.4.515v7.4.515
Problem: In a help buffer the global 'foldmethod' is used. (Paul Marshall) Solution: Reset 'foldmethod' when starting to edit a help file. Move the code to a separate function.
-rw-r--r--src/ex_cmds.c130
-rw-r--r--src/version.c2
2 files changed, 72 insertions, 60 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index b8076fc37..1114f8534 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -34,6 +34,7 @@ static int
_RTLENTRYF
#endif
help_compare __ARGS((const void *s1, const void *s2));
+static void prepare_help_buffer __ARGS((void));
/*
* ":ascii" and "ga".
@@ -3531,71 +3532,15 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
oldbuf = (flags & ECMD_OLDBUF);
}
- if ((flags & ECMD_SET_HELP) || keep_help_flag)
- {
- char_u *p;
-
- curbuf->b_help = TRUE;
-#ifdef FEAT_QUICKFIX
- set_string_option_direct((char_u *)"buftype", -1,
- (char_u *)"help", OPT_FREE|OPT_LOCAL, 0);
-#endif
-
- /*
- * Always set these options after jumping to a help tag, because the
- * user may have an autocommand that gets in the way.
- * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and
- * latin1 word characters (for translated help files).
- * Only set it when needed, buf_init_chartab() is some work.
- */
- p =
-#ifdef EBCDIC
- (char_u *)"65-255,^*,^|,^\"";
-#else
- (char_u *)"!-~,^*,^|,^\",192-255";
-#endif
- if (STRCMP(curbuf->b_p_isk, p) != 0)
- {
- set_string_option_direct((char_u *)"isk", -1, p,
- OPT_FREE|OPT_LOCAL, 0);
- check_buf_options(curbuf);
- (void)buf_init_chartab(curbuf, FALSE);
- }
-
- curbuf->b_p_ts = 8; /* 'tabstop' is 8 */
- curwin->w_p_list = FALSE; /* no list mode */
-
- curbuf->b_p_ma = FALSE; /* not modifiable */
- curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */
- curwin->w_p_nu = 0; /* no line numbers */
- curwin->w_p_rnu = 0; /* no relative line numbers */
- RESET_BINDING(curwin); /* no scroll or cursor binding */
-#ifdef FEAT_ARABIC
- curwin->w_p_arab = FALSE; /* no arabic mode */
-#endif
-#ifdef FEAT_RIGHTLEFT
- curwin->w_p_rl = FALSE; /* help window is left-to-right */
-#endif
-#ifdef FEAT_FOLDING
- curwin->w_p_fen = FALSE; /* No folding in the help window */
-#endif
-#ifdef FEAT_DIFF
- curwin->w_p_diff = FALSE; /* No 'diff' */
-#endif
-#ifdef FEAT_SPELL
- curwin->w_p_spell = FALSE; /* No spell checking */
-#endif
-
#ifdef FEAT_AUTOCMD
- buf = curbuf;
+ buf = curbuf;
#endif
- set_buflisted(FALSE);
+ if ((flags & ECMD_SET_HELP) || keep_help_flag)
+ {
+ prepare_help_buffer();
}
else
{
-#ifdef FEAT_AUTOCMD
- buf = curbuf;
-#endif
/* Don't make a buffer listed if it's a help buffer. Useful when
* using CTRL-O to go back to a help file. */
if (!curbuf->b_help)
@@ -6222,6 +6167,71 @@ find_help_tags(arg, num_matches, matches, keep_lang)
}
/*
+ * Called when starting to edit a buffer for a help file.
+ */
+ static void
+prepare_help_buffer()
+{
+ char_u *p;
+
+ curbuf->b_help = TRUE;
+#ifdef FEAT_QUICKFIX
+ set_string_option_direct((char_u *)"buftype", -1,
+ (char_u *)"help", OPT_FREE|OPT_LOCAL, 0);
+#endif
+
+ /*
+ * Always set these options after jumping to a help tag, because the
+ * user may have an autocommand that gets in the way.
+ * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and
+ * latin1 word characters (for translated help files).
+ * Only set it when needed, buf_init_chartab() is some work.
+ */
+ p =
+#ifdef EBCDIC
+ (char_u *)"65-255,^*,^|,^\"";
+#else
+ (char_u *)"!-~,^*,^|,^\",192-255";
+#endif
+ if (STRCMP(curbuf->b_p_isk, p) != 0)
+ {
+ set_string_option_direct((char_u *)"isk", -1, p, OPT_FREE|OPT_LOCAL, 0);
+ check_buf_options(curbuf);
+ (void)buf_init_chartab(curbuf, FALSE);
+ }
+
+ /* Don't use the global foldmethod.*/
+ set_string_option_direct((char_u *)"fdm", -1, (char_u *)"manual",
+ OPT_FREE|OPT_LOCAL, 0);
+
+ curbuf->b_p_ts = 8; /* 'tabstop' is 8 */
+ curwin->w_p_list = FALSE; /* no list mode */
+
+ curbuf->b_p_ma = FALSE; /* not modifiable */
+ curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */
+ curwin->w_p_nu = 0; /* no line numbers */
+ curwin->w_p_rnu = 0; /* no relative line numbers */
+ RESET_BINDING(curwin); /* no scroll or cursor binding */
+#ifdef FEAT_ARABIC
+ curwin->w_p_arab = FALSE; /* no arabic mode */
+#endif
+#ifdef FEAT_RIGHTLEFT
+ curwin->w_p_rl = FALSE; /* help window is left-to-right */
+#endif
+#ifdef FEAT_FOLDING
+ curwin->w_p_fen = FALSE; /* No folding in the help window */
+#endif
+#ifdef FEAT_DIFF
+ curwin->w_p_diff = FALSE; /* No 'diff' */
+#endif
+#ifdef FEAT_SPELL
+ curwin->w_p_spell = FALSE; /* No spell checking */
+#endif
+
+ set_buflisted(FALSE);
+}
+
+/*
* After reading a help file: May cleanup a help buffer when syntax
* highlighting is not used.
*/
diff --git a/src/version.c b/src/version.c
index 5ca2f2723..2f524c85d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 515,
+/**/
514,
/**/
513,