[vim/vim] `gm` and `g^` do not remember column for vertical motion in folds (Issue #11596)

21 views
Skip to first unread message

Matt Ellis

unread,
Nov 23, 2022, 10:18:09 AM11/23/22
to vim/vim, Subscribed

Steps to reproduce

Given some text:

    Alice was beginning to get very tired of sitting by her sister on the bank, and

    of having nothing to do: once or twice she had peeped into the book her sister

    was reading, but it had no pictures or conversations in it, “and what is the use

    of a book,” thought Alice “without pictures or conversations?”

  1. Create a fold of the middle two lines (jVjzf)
  2. Position cursor on the fold
  3. Type gm, note that :set ruler shows 59-1
  4. Type k, the cursor navigates to line 1, column 1

Expected behaviour

When typing gm<Up> I expect Vim to use the current column (59) on the new line

Similarly, if using g^, the ruler shows 5-1 but hitting <Up> moves to column 1. However, g$ shows 83-1 in the ruler and hitting <Up> will move to column 83 on line 1, as expected.

The column is remembered and used if typing gm<Right>, g^<Right> or g$<Right>. The fold is opened and the caret is correctly moved.

Version of Vim

9.0 (2022 Jun 28, compiled Oct 19 2022 18:24:48)

Environment

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Oct 19 2022 18:24:48)
macOS version - x86_64
Included patches: 1-800
Compiled by Homebrew

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11596@github.com>

Brandon Simmons

unread,
Jan 10, 2023, 10:11:06 AM1/10/23
to vim/vim, Subscribed

I looked into this a bit but will leave the rest to someone else, since it will take me too much time to understand everything and create a thorough patch.
Here are my findings, though:

  • I tested old versions and have concluded that this is not a regression.
  • The functions that are bugged, like nv_g_home_m_cmd() in normal.c, set w_set_curswant to TRUE, while a function that is not bugged (nv_g_dollar_cmd()) instead calls update_curswant_force(). If you replace the statement that sets w_set_curswant to TRUE with a call to update_curswant_force(), the bug seems to be fixed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11596/1377419532@github.com>

Bram Moolenaar

unread,
Feb 15, 2023, 2:58:38 PM2/15/23
to vim/vim, Subscribed

Updating w_curswant every time adds over head (quite a lot for a long line).
So, the solution could be to call update_curswant_force() if "curwin->w_cline"_folded is set.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11596/1431945030@github.com>

Christian Brabandt

unread,
Nov 17, 2024, 10:20:41 AM11/17/24
to vim/vim, Subscribed

Closed #11596 as completed via 9848fac.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/11596/issue_event/15325142445@github.com>

Reply all
Reply to author
Forward
0 new messages