[vim/vim] fix(highlight): pum matched text respect icase (PR #15023)

16 views
Skip to first unread message

glepnir

unread,
Jun 16, 2024, 8:33:41 AM (10 days ago) Jun 16
to vim/vim, Subscribed

Problem:

  1. STRNCMP does not respect the upper case when icase is set of complete item.
  2. ins_compl_stop will free all leader even bs just delete the one leader.

Solution:
1.use MB_STRNICMP instead
2. when compl_leader is null use compl_orig_text for match.

Fix #15021


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/15023

Commit Summary

  • f9eeaa3 fix(highlight): pum matched text respect icase

File Changes

(4 files)

Patch Links:


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

glepnir

unread,
Jun 16, 2024, 8:34:58 AM (10 days ago) Jun 16
to vim/vim, Push

@glepnir pushed 1 commit.

  • 4172d16 fix(highlight): pum matched text respect icase


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/before/f9eeaa3755a8308d58dad040aabcec359fc66d78/after/4172d160febed3a7a63d27de726711845b841eaf@github.com>

zeertzjq

unread,
Jun 16, 2024, 8:42:13 AM (10 days ago) Jun 16
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/popupmenu.c:

> @@ -485,7 +485,7 @@ pum_screen_put_with_attr(int row, int col, char_u *text, int textlen, hlf_T hlf)
 	    }
 	}
 	else if (!in_fuzzy && (ptr - text < leader_len)
-			     && (STRNCMP(text, match_leader, leader_len) == 0))
+			     && (MB_STRNICMP(text, match_leader, leader_len) == 0))

This function is called repeatedly when it only needs to be called once. Maybe you can rebase this onto #15020.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/review/2121410440@github.com>

zeertzjq

unread,
Jun 16, 2024, 8:43:16 AM (10 days ago) Jun 16
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/insexpand.c:

> @@ -1448,7 +1448,7 @@ ins_compl_show_pum(void)
     char_u *
 ins_compl_leader(void)
 {
-    return compl_leader;
+    return compl_leader != NULL ? compl_leader : compl_orig_text;

Is this change tested?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/review/2121412286@github.com>

glepnir

unread,
Jun 16, 2024, 8:44:41 AM (10 days ago) Jun 16
to vim/vim, Subscribed

@glepnir commented on this pull request.


In src/insexpand.c:

> @@ -1448,7 +1448,7 @@ ins_compl_show_pum(void)
     char_u *
 ins_compl_leader(void)
 {
-    return compl_leader;
+    return compl_leader != NULL ? compl_leader : compl_orig_text;

missed. should add a bs step.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/review/2121414485@github.com>

glepnir

unread,
Jun 16, 2024, 8:45:17 AM (10 days ago) Jun 16
to vim/vim, Subscribed

@glepnir commented on this pull request.


In src/popupmenu.c:

> @@ -485,7 +485,7 @@ pum_screen_put_with_attr(int row, int col, char_u *text, int textlen, hlf_T hlf)
 	    }
 	}
 	else if (!in_fuzzy && (ptr - text < leader_len)
-			     && (STRNCMP(text, match_leader, leader_len) == 0))
+			     && (MB_STRNICMP(text, match_leader, leader_len) == 0))

oh nice. i will wait that.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/review/2121415423@github.com>

glepnir

unread,
Jun 16, 2024, 8:45:27 AM (10 days ago) Jun 16
to vim/vim, Subscribed

@glepnir commented on this pull request.


In src/popupmenu.c:

> @@ -485,7 +485,7 @@ pum_screen_put_with_attr(int row, int col, char_u *text, int textlen, hlf_T hlf)
 	    }
 	}
 	else if (!in_fuzzy && (ptr - text < leader_len)
-			     && (STRNCMP(text, match_leader, leader_len) == 0))
+			     && (MB_STRNICMP(text, match_leader, leader_len) == 0))

mark as draft then.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/review/2121415772@github.com>

glepnir

unread,
Jun 16, 2024, 9:50:42 AM (10 days ago) Jun 16
to vim/vim, Push

@glepnir pushed 1 commit.

  • b6d1d0e fix(highlight): pum matched text respect icase

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/before/4172d160febed3a7a63d27de726711845b841eaf/after/b6d1d0ee7ee362f8e779b12006a74792efefbdf4@github.com>

glepnir

unread,
Jun 16, 2024, 9:51:49 AM (10 days ago) Jun 16
to vim/vim, Push

@glepnir pushed 1 commit.

  • 9138ea9 fix(highlight): pum matched text respect icase

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/before/b6d1d0ee7ee362f8e779b12006a74792efefbdf4/after/9138ea9af310833fad9ad6233395f0b81be06c8c@github.com>

Christian Brabandt

unread,
Jun 16, 2024, 10:53:43 AM (10 days ago) Jun 16
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In src/popupmenu.c:

> @@ -485,7 +485,7 @@ pum_screen_put_with_attr(int row, int col, char_u *text, int textlen, hlf_T hlf)
 	    }
 	}
 	else if (!in_fuzzy && (ptr - text < leader_len)
-			     && (STRNCMP(text, match_leader, leader_len) == 0))
+			     && (MB_STRNICMP(text, match_leader, leader_len) == 0))

I have merged it.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/review/2121476308@github.com>

zeertzjq

unread,
Jun 16, 2024, 8:05:57 PM (10 days ago) Jun 16
to vim/vim, Push

@zeertzjq pushed 1 commit.

  • 4a03b57 fix(highlight): pum matched text respect icase

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/before/9138ea9af310833fad9ad6233395f0b81be06c8c/after/4a03b57ac9bb907cfbc67788b710192187774485@github.com>

zeertzjq

unread,
Jun 16, 2024, 8:10:46 PM (10 days ago) Jun 16
to vim/vim, Subscribed

I force-pushed to your branch to rebase this PR. It also seems that the two screen dumps add in this PR are the same, so I combined them into one.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/c2171949560@github.com>

glepnir

unread,
Jun 17, 2024, 2:00:43 AM (9 days ago) Jun 17
to vim/vim, Subscribed

it's fine :)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/c2172352842@github.com>

Christian Brabandt

unread,
Jun 17, 2024, 12:39:31 PM (9 days ago) Jun 17
to vim/vim, Subscribed

Closed #15023 via f189138.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/15023/issue_event/13188540374@github.com>

Reply all
Reply to author
Forward
0 new messages