summaryrefslogtreecommitdiff
path: root/src/mark.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2004-09-13 20:26:32 +0000
committerBram Moolenaar <Bram@vim.org>2004-09-13 20:26:32 +0000
commitc0197e2815208269fa9ba2fba95230138ec39ceb (patch)
tree21db1c3acd16fb095a8e34ce2e15ed87275cbd79 /src/mark.c
parent15d0a8c77dad867b69822e2fd8f9f6bbcf765c48 (diff)
downloadvim-git-c0197e2815208269fa9ba2fba95230138ec39ceb.tar.gz
updated for version 7.0016v7.0016
Diffstat (limited to 'src/mark.c')
-rw-r--r--src/mark.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/mark.c b/src/mark.c
index e1b800eb1..ea941e59b 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -743,6 +743,91 @@ show_one_mark(c, arg, p, name, current)
}
}
+/*
+ * ":delmarks[!] [marks]"
+ */
+ void
+ex_delmarks(eap)
+ exarg_T *eap;
+{
+ char_u *p;
+ int from, to;
+ int i;
+ int lower;
+ int digit;
+ int n;
+
+ if (*eap->arg == NUL && eap->forceit)
+ /* clear all marks */
+ clrallmarks(curbuf);
+ else if (eap->forceit)
+ EMSG(_(e_invarg));
+ else if (*eap->arg == NUL)
+ EMSG(_(e_argreq));
+ else
+ {
+ /* clear specified marks only */
+ for (p = eap->arg; *p != NUL; ++p)
+ {
+ lower = ASCII_ISLOWER(*p);
+ digit = VIM_ISDIGIT(*p);
+ if (lower || digit || ASCII_ISUPPER(*p))
+ {
+ if (p[1] == '-')
+ {
+ /* clear range of marks */
+ from = *p;
+ to = p[2];
+ if (!(lower ? ASCII_ISLOWER(p[2])
+ : (digit ? VIM_ISDIGIT(p[2])
+ : ASCII_ISUPPER(p[2])))
+ || to < from)
+ {
+ EMSG2(_(e_invarg2), p);
+ return;
+ }
+ p += 2;
+ }
+ else
+ /* clear one lower case mark */
+ from = to = *p;
+
+ for (i = from; i <= to; ++i)
+ {
+ if (lower)
+ curbuf->b_namedm[i - 'a'].lnum = 0;
+ else
+ {
+ if (digit)
+ n = i - '0' + NMARKS;
+ else
+ n = i - 'A';
+ namedfm[n].fmark.mark.lnum = 0;
+ vim_free(namedfm[n].fname);
+ namedfm[n].fname = NULL;
+ }
+ }
+ }
+ else
+ switch (*p)
+ {
+ case '"': curbuf->b_last_cursor.lnum = 0; break;
+ case '^': curbuf->b_last_insert.lnum = 0; break;
+ case '.': curbuf->b_last_change.lnum = 0; break;
+ case '[': curbuf->b_op_start.lnum = 0; break;
+ case ']': curbuf->b_op_end.lnum = 0; break;
+#ifdef FEAT_VISUAL
+ case '<': curbuf->b_visual_start.lnum = 0; break;
+ case '>': curbuf->b_visual_end.lnum = 0; break;
+#endif
+ case ' ': break;
+ default: EMSG2(_(e_invarg2), p);
+ return;
+ }
+ }
+ }
+}
+
#if defined(FEAT_JUMPLIST) || defined(PROTO)
/*
* print the jumplist