diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-07-19 22:09:06 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-07-19 22:09:06 +0200 |
commit | 54c3fcd852f9d986f81547429e850b3364f058d6 (patch) | |
tree | d5700d0f8f7637aec2b86b5c599ee8af411a51e2 /src/mark.c | |
parent | 682d0a15462f3d4f9404e98a56b340ae131cbb09 (diff) | |
download | vim-git-54c3fcd852f9d986f81547429e850b3364f058d6.tar.gz |
patch 8.2.1252: ":marks" may show '< and '> mixed upv8.2.1252
Problem: ":marks" may show '< and '> mixed up.
Solution: Show the mark position as where '< and '> would jump.
Diffstat (limited to 'src/mark.c')
-rw-r--r-- | src/mark.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mark.c b/src/mark.c index 948a1826e..aa9445ed0 100644 --- a/src/mark.c +++ b/src/mark.c @@ -704,6 +704,7 @@ 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; @@ -731,8 +732,17 @@ ex_marks(exarg_T *eap) show_one_mark(']', arg, &curbuf->b_op_end, NULL, TRUE); show_one_mark('^', arg, &curbuf->b_last_insert, NULL, TRUE); show_one_mark('.', arg, &curbuf->b_last_change, 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_POS(*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); } |