]> granicus.if.org Git - vim/commitdiff
patch 9.0.0188: strange effects when using "text_align" with non-zero column v9.0.0188
authorBram Moolenaar <Bram@vim.org>
Wed, 10 Aug 2022 18:50:47 +0000 (19:50 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 10 Aug 2022 18:50:47 +0000 (19:50 +0100)
Problem:    Strange effects when using virtual text with "text_align" and
            non-zero column. (Martin Tournoij)
Solution:   Give an error. (closes #10888)

src/errors.h
src/testdir/test_textprop.vim
src/textprop.c
src/version.c

index 3b23c88adbd4c8598eb2de77805c7ba61d3772b8..8aad956d9a62a1c2f83d8beca15a6b345ac522b8 100644 (file)
@@ -3313,4 +3313,6 @@ EXTERN char e_cmdline_window_already_open[]
 #ifdef FEAT_PROP_POPUP
 EXTERN char e_cannot_use_negative_id_after_adding_textprop_with_text[]
        INIT(= N_("E1293: Cannot use a negative id after adding a textprop with text"));
+EXTERN char e_can_only_use_text_align_when_column_is_zero[]
+       INIT(= N_("E1294: Can only use text_align when column is zero"));
 #endif
index c6d15b5bd765dc7d47a615ea8e9dac8704aaa7e7..701e853e80800f995895905bc38efd8b4621ddeb 100644 (file)
@@ -2530,6 +2530,8 @@ func Test_props_with_text_after()
 
   call StopVimInTerminal(buf)
   call delete('XscriptPropsWithTextAfter')
+
+  call assert_fails('call prop_add(1, 2, #{text: "yes", text_align: "right", type: "some"})', 'E1294:')
 endfunc
 
 func Test_props_with_text_after_below_trunc()
index 45023e88d5e789a6eeaaa24ce77779a0590b6455..f33edc2117ad8f2df201230ed3c97c77061d6b75 100644 (file)
@@ -488,6 +488,11 @@ prop_add_common(
 
            if (p == NULL)
                goto theend;
+           if (start_col != 0)
+           {
+               emsg(_(e_can_only_use_text_align_when_column_is_zero));
+               goto theend;
+           }
            if (STRCMP(p, "right") == 0)
                flags |= TP_FLAG_ALIGN_RIGHT;
            else if (STRCMP(p, "below") == 0)
index 1e326b31ee3ce1e0ead3124e80de3ed8e89bd4f4..6675c3a4a53468e48439f6043fa84fe182772667 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    188,
 /**/
     187,
 /**/