diff options
author | Peter Wolf <pwolf2310@gmail.com> | 2020-07-26 11:28:31 +0200 |
---|---|---|
committer | Peter Wolf <pwolf2310@gmail.com> | 2020-07-28 23:33:08 +0200 |
commit | e5e547ded4e7241f0c3afaf7f29f7e2a4409bd75 (patch) | |
tree | 5e379222facc46cf83cc1237d663c1d9d41c18a3 /src/nvim/mark.c | |
parent | 5f5bd576e5395ef0cd6198f16d10edc1ff4bbe76 (diff) | |
download | rneovim-e5e547ded4e7241f0c3afaf7f29f7e2a4409bd75.tar.gz rneovim-e5e547ded4e7241f0c3afaf7f29f7e2a4409bd75.tar.bz2 rneovim-e5e547ded4e7241f0c3afaf7f29f7e2a4409bd75.zip |
vim-patch:8.2.1252: ":marks" may show '< and '> mixed up
Problem: ":marks" may show '< and '> mixed up.
Solution: Show the mark position as where '< and '> would jump.
https://github.com/vim/vim/commit/54c3fcd852f9d986f81547429e850b3364f058d6
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); } |