[vim/vim] Incorrect search result (Issue #17312)

17 views
Skip to first unread message

tahzibijafar

unread,
May 13, 2025, 2:19:07 PMMay 13
to vim/vim, Subscribed
tahzibijafar created an issue (vim/vim#17312)

Steps to reproduce

1- I set igonorecase and smartcase and I set shortmess=ilnxtToO (I omitted S)

and I search /main in the following line

MainmainmainmmmainmAin

It works Ok and it I press n until 5th occurance (now the cursor is under m of mAin)

now I search as /mAin
now it shows [5/5] and it not correct.

Thank you

Expected behaviour

I expect It shows [1/1]

Version of Vim

9.1

Environment

Linux

Logs and stack traces


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/17312@github.com>

Christian Brabandt

unread,
May 13, 2025, 4:37:37 PMMay 13
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#17312)

Seems to work for me. Did you try using vim --clean ?


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/17312/2877881583@github.com>

tahzibijafar

unread,
May 14, 2025, 12:42:38 AMMay 14
to vim/vim, Subscribed
tahzibijafar left a comment (vim/vim#17312)

I also try by vim --clean and it doesn't work.


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/17312/2878656014@github.com>

zeertzjq

unread,
May 14, 2025, 1:46:58 AMMay 14
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#17312)

There seems to be a strange comment here:

    // If anything relevant changed the count has to be recomputed.
    // MB_STRNICMP ignores case, but we should not ignore case.
    // Unfortunately, there is no MB_STRNICMP function.
    // XXX: above comment should be "no MB_STRCMP function" ?
    if (!(chgtick == CHANGEDTICK(curbuf)
	&& (lastpat != NULL
	    && MB_STRNICMP(lastpat, spats[last_idx].pat, lastpatlen) == 0
	    && lastpatlen == spats[last_idx].patlen
	)
	&& EQUAL_POS(lastpos, *cursor_pos)
	&& lbuf == curbuf) || wraparound || cur < 0
	    || (maxcount > 0 && cur > maxcount) || recompute)


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/17312/2878747622@github.com>

Gary Johnson

unread,
May 14, 2025, 1:50:45 AMMay 14
to reply+ACY5DGDDV3KDJ5FLSY...@reply.github.com, vim...@googlegroups.com
I can reproduce tahzibijafar's reported result with Vim 9.1.1365 on
Ubuntu 24.04.2 with my normal configuration and with

$ vim -N -u NONE -i NONE

and the additional settings.

I have not looked into the reason.

Regards,
Gary

vim-dev ML

unread,
May 14, 2025, 1:51:15 AMMay 14
to vim/vim, vim-dev ML, Your activity
vim-ml left a comment (vim/vim#17312)
I can reproduce tahzibijafar&#39;s reported result with Vim 9.1.1365 on<br> Ubuntu 24.04.2 with my normal configuration and with<br> <br> $ vim -N -u NONE -i NONE<br> <br> and the additional settings.<br> <br> I have not looked into the reason.<br> <br> Regards,<br> Gary<br> <br>


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/17312/2878755392@github.com>

Christian Brabandt

unread,
May 14, 2025, 2:23:23 AMMay 14
to vim/vim, vim-dev ML, Comment
chrisbra left a comment (vim/vim#17312)

Yes, I think this is related to the missing MB_STRNCMP function


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/17312/2878829619@github.com>

Christian Brabandt

unread,
May 14, 2025, 4:00:33 AMMay 14
to vim/vim, vim-dev ML, Comment
chrisbra left a comment (vim/vim#17312)

I think we can just use STRNCMP instead?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/17312/2879173270@github.com>

Christian Brabandt

unread,
May 16, 2025, 1:41:23 PMMay 16
to vim/vim, vim-dev ML, Comment

Closed #17312 as completed via 670d0c1.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issue/17312/issue_event/17692439911@github.com>

Reply all
Reply to author
Forward
0 new messages