summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-01-27 18:44:16 +0100
committerBram Moolenaar <Bram@vim.org>2015-01-27 18:44:16 +0100
commit3b3a9498d1eab3c28c524cce115160528a9a9297 (patch)
tree60edbd96e70b18901cf68760a971f191d590c47c /src/ops.c
parent6bf7c523ad54f625547ef2cc6009c28c0dd337ed (diff)
downloadvim-git-3b3a9498d1eab3c28c524cce115160528a9a9297.tar.gz
updated for version 7.4.605v7.4.605
Problem: The # register is not writable, it cannot be restored after jumping around. Solution: Make the # register writable. (Marcin Szamotulski)
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/ops.c b/src/ops.c
index 6df1121a5..a4261cb56 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -856,11 +856,12 @@ valid_yank_reg(regname, writing)
if ( (regname > 0 && ASCII_ISALNUM(regname))
|| (!writing && vim_strchr((char_u *)
#ifdef FEAT_EVAL
- "/.%#:="
+ "/.%:="
#else
- "/.%#:"
+ "/.%:"
#endif
, regname) != NULL)
+ || regname == '#'
|| regname == '"'
|| regname == '-'
|| regname == '_'
@@ -6514,6 +6515,27 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
return;
}
+ if (name == '#')
+ {
+ buf_T *buf;
+
+ if (VIM_ISDIGIT(*str))
+ {
+ int num = atoi((char *)str);
+
+ buf = buflist_findnr(num);
+ if (buf == NULL)
+ EMSGN(_(e_nobufnr), (long)num);
+ }
+ else
+ buf = buflist_findnr(buflist_findpat(str, str + STRLEN(str),
+ TRUE, FALSE, FALSE));
+ if (buf == NULL)
+ return;
+ curwin->w_alt_fnum = buf->b_fnum;
+ return;
+ }
+
#ifdef FEAT_EVAL
if (name == '=')
{