diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-10 19:50:47 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-10 19:50:47 +0100 |
commit | 82b14c143aa1e70d55509cc9fa408828e90c93de (patch) | |
tree | dd5bd96742192f37f63c4aafdcfb05685009702d | |
parent | 96bde99bf890acd9952863a02c1d15edca2000e1 (diff) |
patch 9.0.0188: strange effects when using "text_align" with non-zero columnv9.0.0188
Problem: Strange effects when using virtual text with "text_align" and
non-zero column. (Martin Tournoij)
Solution: Give an error. (closes #10888)
-rw-r--r-- | src/errors.h | 2 | ||||
-rw-r--r-- | src/testdir/test_textprop.vim | 2 | ||||
-rw-r--r-- | src/textprop.c | 5 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 11 insertions, 0 deletions
diff --git a/src/errors.h b/src/errors.h index 3b23c88adb..8aad956d9a 100644 --- a/src/errors.h +++ b/src/errors.h @@ -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 diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index c6d15b5bd7..701e853e80 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -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() diff --git a/src/textprop.c b/src/textprop.c index 45023e88d5..f33edc2117 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -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) diff --git a/src/version.c b/src/version.c index 1e326b31ee..6675c3a4a5 100644 --- a/src/version.c +++ b/src/version.c @@ -736,6 +736,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 188, +/**/ 187, /**/ 186, |