diff options
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r-- | src/nvim/mark.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c index fa7c7d61c9..1ecfae57ed 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -632,6 +632,7 @@ void ex_marks(exarg_T *eap) char_u *arg = eap->arg; int i; char_u *name; + pos_T *posp, *startp, *endp; if (arg != NULL && *arg == NUL) arg = NULL; @@ -657,8 +658,18 @@ void ex_marks(exarg_T *eap) show_one_mark(']', arg, &curbuf->b_op_end, NULL, true); show_one_mark('^', arg, &curbuf->b_last_insert.mark, NULL, true); show_one_mark('.', arg, &curbuf->b_last_change.mark, NULL, true); - show_one_mark('<', arg, &curbuf->b_visual.vi_start, NULL, true); - show_one_mark('>', arg, &curbuf->b_visual.vi_end, NULL, true); + + // Show the marks as where they will jump to. + startp = &curbuf->b_visual.vi_start; + endp = &curbuf->b_visual.vi_end; + if ((lt(*startp, *endp) || endp->lnum == 0) && startp->lnum != 0) { + posp = startp; + } else { + posp = endp; + } + show_one_mark('<', arg, posp, NULL, true); + show_one_mark('>', arg, posp == startp ? endp : startp, NULL, true); + show_one_mark(-1, arg, NULL, NULL, false); } |