Search count message shows "[?/??]" for some searches with few matches

7 views
Skip to first unread message

Gary Johnson

unread,
Dec 31, 2021, 4:27:25 AM12/31/21
to vim...@googlegroups.com
I sometimes search for lines that exceed some length with a search
pattern like this:

/\%79v.

Even when the number of matches is small, the search count message
sometimes shows "[?/??]".

Steps to reproduce

1. cd to Vim's src directory.
2. Execute
$ vim -N -u NONE -i NONE -c 'set shortmess-=S' option.c
3. Type the following search pattern.
/\%82v.
4. Note the search count message, which is
[?/??]

There are 14 matches in that file, well within the limits of the
search count message.

Expected behavior

I expected the search count message to be [1/14].

Version of Vim

8.2.3941

Environment

Operating system: Ubuntu 20.04.3 LTS
Terminal: Chromebook Crosh Window
Value of $TERM: screen-256color
Shell: bash 5.0.17

The Crosh Window is running bash and ssh to the remote host,
which is running tmux 2.9a.

Additional Information

I tried to use main.c as the example file, i.e.

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

and a search pattern of

/\%79v.

but the results were not repeatable. I would hit n to go to the
next match and sometimes the search count message would be
correct and at other matches it would be [?/??]. Further,
I could pass a match showing [?/??] by typing n, the next match
would have a correct search count message, then I could type
N to go back to the [?/??] message and it would be correct.
Which matches showed correct messages and which showed [?/??]
varied each time I ran vim, as though there was an uninitialized
variable involved.

Regards,
Gary

Bram Moolenaar

unread,
Dec 31, 2021, 7:03:05 AM12/31/21
to vim...@googlegroups.com, Gary Johnson

Gary Johnson wrote:

> I sometimes search for lines that exceed some length with a search
> pattern like this:
>
> /\%79v.
>
> Even when the number of matches is small, the search count message
> sometimes shows "[?/??]".

This happens when the search runs into a time limit. It is currently
set to 40 msec. That's high enough to make most searches work, and low
enough that you usually don't notice the delay.

There currently is no way to set another timeout. You can pass a
timeout to the searchcount() function, but that's not used here.

Adding an option for the time is likely not very useful, you would want
to keep it low normally, and only set it high when you actually look
at the count. Perhaps we should have a command to force displaying the
count without a timeout.


--
hundred-and-one symptoms of being an internet addict:
167. You have more than 200 websites bookmarked.

/// 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