aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mark.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-21 17:42:17 +0800
committerGitHub <noreply@github.com>2022-07-21 17:42:17 +0800
commitc15e9d3746ee0aa6a9d80596bffc19e9ac9612bc (patch)
tree63151061bb72c56bed896bb93224687524fec314 /src/nvim/mark.c
parent6a7d00469bd64e8fe63468b5c1643087432709e9 (diff)
downloadrneovim-c15e9d3746ee0aa6a9d80596bffc19e9ac9612bc.tar.gz
rneovim-c15e9d3746ee0aa6a9d80596bffc19e9ac9612bc.tar.bz2
rneovim-c15e9d3746ee0aa6a9d80596bffc19e9ac9612bc.zip
fix(mark): give correct error message when mark is in another buffer (#19454)
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r--src/nvim/mark.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 66855c66b5..b7d0e9b401 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -339,11 +339,11 @@ fmark_T *mark_get(buf_T *buf, win_T *win, fmark_T *fmp, MarkGet flag, int name)
fmark_T *fm = NULL;
if (ASCII_ISUPPER(name) || ascii_isdigit(name)) {
// Global marks
- xfmark_T *xfm = mark_get_global(!(flag & kMarkAllNoResolve), name);
+ xfmark_T *xfm = mark_get_global(flag != kMarkAllNoResolve, name);
fm = &xfm->fmark;
- // Only wanted marks belonging to the buffer
- if ((flag & kMarkBufLocal) && xfm->fmark.fnum != buf->handle) {
- return NULL;
+ if (flag == kMarkBufLocal && xfm->fmark.fnum != buf->handle) {
+ // Only wanted marks belonging to the buffer
+ return pos_to_mark(buf, NULL, (pos_T){ .lnum = 0 });
}
} else if (name > 0 && name < NMARK_LOCAL_MAX) {
// Local Marks
@@ -508,11 +508,12 @@ fmark_T *mark_get_visual(buf_T *buf, int name)
/// Pass an fmp if multiple c
/// @note view fields are set to 0.
/// @param buf for fmark->fnum.
-/// @param pos for fmrak->mark.
+/// @param pos for fmark->mark.
/// @param fmp pointer to save the mark.
///
/// @return[static] Mark with the given information.
fmark_T *pos_to_mark(buf_T *buf, fmark_T *fmp, pos_T pos)
+ FUNC_ATTR_NONNULL_RET
{
static fmark_T fms = INIT_FMARK;
fmark_T *fm = fmp == NULL ? &fms : fmp;