Mercurial > vim
diff src/textprop.c @ 32907:98db7b3b4827 v9.0.1762
patch 9.0.1762: Not able to get the virtual text property
Commit: https://github.com/vim/vim/commit/f9037f186ad45b56c84f1efdc131480bec159e4f
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Aug 20 18:27:45 2023 +0200
patch 9.0.1762: Not able to get the virtual text property
Problem: Not able to get the virtual text property
Solution: Make prop_list() return virtual text and alignment
closes: #12860
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 20 Aug 2023 18:30:07 +0200 |
parents | 695b50472e85 |
children | c7a332a34fe7 |
line wrap: on
line diff
--- a/src/textprop.c +++ b/src/textprop.c @@ -990,6 +990,31 @@ prop_fill_dict(dict_T *dict, textprop_T dict_add_number(dict, "type_bufnr", buf->b_fnum); else dict_add_number(dict, "type_bufnr", 0); + if (prop->tp_id < 0) + { + // virtual text property + garray_T *gap = &buf->b_textprop_text; + char_u *text; + + // negate the property id to get the string index + text = ((char_u **)gap->ga_data)[-prop->tp_id - 1]; + dict_add_string(dict, "text", text); + + // text_align + char_u *text_align = NULL; + if (prop->tp_flags & TP_FLAG_ALIGN_RIGHT) + text_align = (char_u *)"right"; + else if (prop->tp_flags & TP_FLAG_ALIGN_ABOVE) + text_align = (char_u *)"above"; + else if (prop->tp_flags & TP_FLAG_ALIGN_BELOW) + text_align = (char_u *)"below"; + if (text_align != NULL) + dict_add_string(dict, "text_align", text_align); + + // text_wrap + if (prop->tp_flags & TP_FLAG_WRAP) + dict_add_string(dict, "text_wrap", (char_u *)"wrap"); + } } /*