To: vim_dev@googlegroups.com Subject: Patch 9.0.0489 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0489 Problem: Using "end_lnum" with virtual text causes problems. Solution: Disallow using "end_lnum" with virtual text. (closes #11151) Also disallow "end_col" and "length". Files: src/textprop.c, src/errors.h, src/testdir/test_textprop.vim *** ../vim-9.0.0488/src/textprop.c 2022-09-14 22:13:06.069843985 +0100 --- src/textprop.c 2022-09-17 18:39:34.458642984 +0100 *************** *** 488,493 **** --- 488,501 ---- if (dict_has_key(dict, "text")) { + if (dict_has_key(dict, "length") + || dict_has_key(dict, "end_col") + || dict_has_key(dict, "end_lnum")) + { + emsg(_(e_cannot_use_length_endcol_and_endlnum_with_text)); + goto theend; + } + text = dict_get_string(dict, "text", TRUE); if (text == NULL) goto theend; *** ../vim-9.0.0488/src/errors.h 2022-09-11 15:14:00.547020055 +0100 --- src/errors.h 2022-09-17 18:41:17.946419728 +0100 *************** *** 3338,3340 **** --- 3338,3344 ---- EXTERN char e_cannot_use_type_with_this_variable_str[] INIT(= N_("E1304: Cannot use type with this variable: %s")); #endif + #ifdef FEAT_PROP_POPUP + EXTERN char e_cannot_use_length_endcol_and_endlnum_with_text[] + INIT(= N_("E1305: Cannot use \"length\", \"end_col\" and \"end_lnum\" with \"text\"")); + #endif *** ../vim-9.0.0488/src/testdir/test_textprop.vim 2022-09-17 17:15:02.447654060 +0100 --- src/testdir/test_textprop.vim 2022-09-17 18:52:13.456934908 +0100 *************** *** 2578,2590 **** call delete('XscriptPropsWithHighlight') endfunc func Test_props_with_text_right_align_twice() CheckRunVimInTerminal let lines =<< trim END call setline(1, ["some text some text some text some text", 'line two']) ! call prop_type_add('MyErrorText', #{ highlight: 'ErrorMsg'}) ! call prop_type_add('MyPadding', #{ highlight: 'DiffChange'}) call prop_add(1, 0, #{type: 'MyPadding', text: ' nothing here', text_wrap: 'wrap'}) call prop_add(1, 0, #{type: 'MyErrorText', text: 'Some error', text_wrap: 'wrap', text_align: 'right'}) call prop_add(1, 0, #{type: 'MyErrorText', text: 'Another error', text_wrap: 'wrap', text_align: 'right'}) --- 2578,2599 ---- call delete('XscriptPropsWithHighlight') endfunc + func Test_prop_add_with_text_fails() + call prop_type_add('failing', #{highlight: 'ErrorMsg'}) + call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_lnum: 1})", 'E1305:') + call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_col: 1})", 'E1305:') + call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', length: 1})", 'E1305:') + + call prop_type_delete('failing') + endfunc + func Test_props_with_text_right_align_twice() CheckRunVimInTerminal let lines =<< trim END call setline(1, ["some text some text some text some text", 'line two']) ! call prop_type_add('MyErrorText', #{highlight: 'ErrorMsg'}) ! call prop_type_add('MyPadding', #{highlight: 'DiffChange'}) call prop_add(1, 0, #{type: 'MyPadding', text: ' nothing here', text_wrap: 'wrap'}) call prop_add(1, 0, #{type: 'MyErrorText', text: 'Some error', text_wrap: 'wrap', text_align: 'right'}) call prop_add(1, 0, #{type: 'MyErrorText', text: 'Another error', text_wrap: 'wrap', text_align: 'right'}) *** ../vim-9.0.0488/src/version.c 2022-09-17 17:15:02.447654060 +0100 --- src/version.c 2022-09-17 18:34:55.355216706 +0100 *************** *** 705,706 **** --- 705,708 ---- { /* Add new patch number below this line */ + /**/ + 489, /**/ -- From "know your smileys": 8-O "Omigod!!" (done "rm -rf *" ?) /// Bram Moolenaar -- Bram@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 ///