gd and gD do not update the search count message

10 views
Skip to first unread message

Gary Johnson

unread,
Nov 9, 2021, 2:31:40 PM11/9/21
to vim...@googlegroups.com
When the search count message has been enabled, and the message
string contains the results of a search, and gd or gD is executed
to jump to the declaration of the word under the cursor, the cursor
does jump to the first occurrence of the word in the buffer, but the
search count message continues to show the results from the previous
search.

I expect the search count message to show the results of the gd or
gD search. It is updated correctly after the first n or N command.

For example, start vim like this:

$ vim -N -u NONE -i NONE -c 'set shortmess-=S'

Enter the following lines into the buffer:

cat
dog
cat
dog
cat

While still on the last line, execute this search:

?dog

The cursor will jump to line 4 and the search count message will be

[2/2]

Now move the cursor down a line to line 5 (over the word "cat") and
type

gD

The cursor will jump to line 1 as expected, but the search count
message is still

[2/2]

Now type

n

The cursor will jump to line 3 as expected and the search count
message will become

[2/3]

also as expected. Type n another two times and the cursor will jump
back to line 1 and the search count message will be

W [1/3]

as I expected it to be following the gD command.

The gd command behaves similarly.

The vim version is 8.2.3567.

Regards,
Gary

Bram Moolenaar

unread,
Nov 12, 2021, 5:02:57 AM11/12/21
to vim...@googlegroups.com, Gary Johnson
Yes, that is confusing. Drawing the actualy count is quite complicated,
it only really works when performing a search. Clearing the text is a
simpler solution.

--
FIRST GUARD: Ah! Now ... we're not allowed to ...
SIR LAUNCELOT runs him through, grabs his spear and stabs the other
guard who collapses in a heap. Hiccoughs quietly.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages