aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mark.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r--src/nvim/mark.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index fe802e48ba..4e05845eb5 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -21,7 +21,6 @@
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
-#include "nvim/misc2.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/path.h"
@@ -131,17 +130,23 @@ int setmark_pos(int c, pos_T *pos, int fnum)
return OK;
}
- if (c > 'z') /* some islower() and isupper() cannot handle
- characters above 127 */
+ buf_T *buf = buflist_findnr(fnum);
+ // Can't set a mark in a non-existant buffer.
+ if (buf == NULL) {
return FAIL;
- if (islower(c)) {
+ }
+
+ if (ASCII_ISLOWER(c)) {
i = c - 'a';
- RESET_FMARK(curbuf->b_namedm + i, *pos, curbuf->b_fnum);
+ RESET_FMARK(buf->b_namedm + i, *pos, fnum);
return OK;
}
- if (isupper(c)) {
- assert(c >= 'A' && c <= 'Z');
- i = c - 'A';
+ if (ASCII_ISUPPER(c) || ascii_isdigit(c)) {
+ if (ascii_isdigit(c)) {
+ i = c - '0' + NMARKS;
+ } else {
+ i = c - 'A';
+ }
RESET_XFMARK(namedfm + i, *pos, fnum, NULL);
return OK;
}
@@ -474,7 +479,7 @@ static void fname2fnum(xfmark_T *fm)
os_dirname(IObuff, IOSIZE);
p = path_shorten_fname(NameBuff, IObuff);
- /* buflist_new() will call fmarks_check_names() */
+ // buflist_new() will call fmarks_check_names()
(void)buflist_new(NameBuff, p, (linenr_T)1, 0);
}
}
@@ -799,6 +804,13 @@ void ex_jumps(exarg_T *eap)
MSG_PUTS("\n>");
}
+void ex_clearjumps(exarg_T *eap)
+{
+ free_jumplist(curwin);
+ curwin->w_jumplistlen = 0;
+ curwin->w_jumplistidx = 0;
+}
+
/*
* print the changelist
*/