]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0619: tests: test_popup fails v9.1.0619
authorglepnir <glephunter@gmail.com>
Fri, 26 Jul 2024 16:15:27 +0000 (18:15 +0200)
committerChristian Brabandt <cb@256bit.org>
Fri, 26 Jul 2024 16:15:27 +0000 (18:15 +0200)
Problem:  tests: test_popup fails
          (after v9.1.0618)
Solution: Correct test, move combining extra attributes to
          pum_compute_text_attrs() (glepnir)

closes: #15353

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/popupmenu.c
src/testdir/test_popup.vim
src/version.c

index 0f19c9e2a121bf4e37848e3a3f8e67c6215c9b75..b6bc1dc45de38c454e392dbc146304b55126606d 100644 (file)
@@ -425,7 +425,7 @@ pum_under_menu(int row, int col, int only_redrawing)
  * Returns attributes for every cell, or NULL if all attributes are the same.
  */
     static int *
-pum_compute_text_attrs(char_u *text, hlf_T hlf)
+pum_compute_text_attrs(char_u *text, hlf_T hlf, int extra_hlattr)
 {
     int                i;
     size_t     leader_len;
@@ -483,6 +483,9 @@ pum_compute_text_attrs(char_u *text, hlf_T hlf)
        else if (matched_start && ptr < text + leader_len)
            new_attr = highlight_attr[hlf == HLF_PSI ? HLF_PMSI : HLF_PMNI];
 
+       if (extra_hlattr > 0)
+           new_attr = hl_combine_attr(new_attr, extra_hlattr);
+
        char_cells = mb_ptr2cells(ptr);
        for (i = 0; i < char_cells; i++)
            attrs[cell_idx + i] = new_attr;
@@ -510,8 +513,7 @@ pum_screen_puts_with_attrs(
     int                cells UNUSED,
     char_u     *text,
     int                textlen,
-    int                *attrs,
-    int                extra_attr)
+    int                *attrs)
 {
     int                col_start = col;
     char_u     *ptr = text;
@@ -528,8 +530,6 @@ pum_screen_puts_with_attrs(
        else
 #endif
            attr = attrs[col - col_start];
-       if (extra_attr > 0)
-           attr = hl_combine_attr(extra_attr, attr);
        screen_puts_len(ptr, char_len, row, col, attr);
        col += mb_ptr2cells(ptr);
        ptr += char_len;
@@ -661,7 +661,8 @@ pum_redraw(void)
                        if (saved != NUL)
                            *p = saved;
 
-                       attrs = pum_compute_text_attrs(st, hlf);
+                       int extra_hlattr = pum_array[idx].pum_extrahlattr;
+                       attrs = pum_compute_text_attrs(st, hlf, extra_hlattr);
 
 #ifdef FEAT_RIGHTLEFT
                        if (pum_rl)
@@ -703,8 +704,7 @@ pum_redraw(void)
                                    else
                                        pum_screen_puts_with_attrs(row,
                                                    col - cells + 1, cells, rt,
-                                                      (int)STRLEN(rt), attrs,
-                                                      pum_array[idx].pum_extrahlattr);
+                                                      (int)STRLEN(rt), attrs);
 
                                    vim_free(rt_start);
                                }
@@ -738,8 +738,7 @@ pum_redraw(void)
                                    screen_puts_len(st, size, row, col, attr);
                                else
                                    pum_screen_puts_with_attrs(row, col, cells,
-                                                             st, size, attrs,
-                                                             pum_array[idx].pum_extrahlattr);
+                                                             st, size, attrs);
 
                                vim_free(st);
                            }
index 30cabf9e263eb0e5950bbd899f48f36a54a3706d..67e600c4c0538cea30548150a411064d631a3e4f 100644 (file)
@@ -1509,9 +1509,9 @@ func Test_pum_extrahl()
       endif
       return {
             \ 'words': [
-            \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', 'extrahl': 'StrikeFake' },
+            \ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', 'hl_group': 'StrikeFake' },
             \ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', },
-            \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'extrahl': 'StrikeFake' },
+            \ { 'word': '你好', 'menu': 'extra text 3', 'kind': 'W', 'hl_group': 'StrikeFake' },
             \]}
     endfunc
     set completeopt=menu
index fd33dab992c665c38439439b77e7175f6be371ec..298d577148ddc4f7bfdb62f37a9d4ea38afdb5aa 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    619,
 /**/
     618,
 /**/