summaryrefslogtreecommitdiffstats
path: root/src/textprop.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-08-22 21:48:50 +0200
committerChristian Brabandt <cb@256bit.org>2023-08-22 21:48:50 +0200
commit171c5b9b0332493faa6caadd8c0d5cf52392d913 (patch)
treeb7879b6e84281e8277dd8cd4db9b5bbfc9f855fe /src/textprop.c
parent757593c07a4f4ac43eb6c6e52fc299abc9bc08bc (diff)
patch 9.0.1782: prop_list() does not return text_padding_leftv9.0.1782
Problem: prop_list() does not return text_padding_left Solution: Store and return the text_padding_left value for text properties closes: #12870 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/textprop.c')
-rw-r--r--src/textprop.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/textprop.c b/src/textprop.c
index 44f7ff0a41..c6e17951d4 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -308,6 +308,7 @@ prop_add_one(
| (lnum < end_lnum ? TP_FLAG_CONT_NEXT : 0)
| ((type->pt_flags & PT_FLAG_INS_START_INCL)
? TP_FLAG_START_INCL : 0);
+ tmp_prop.tp_padleft = text_padding_left;
mch_memmove(newprops + i * sizeof(textprop_T), &tmp_prop,
sizeof(textprop_T));
@@ -969,10 +970,14 @@ prop_fill_dict(dict_T *dict, textprop_T *prop, buf_T *buf)
{
proptype_T *pt;
int buflocal = TRUE;
+ int virtualtext_prop = prop->tp_id < 0;
- dict_add_number(dict, "col", prop->tp_col);
- dict_add_number(dict, "length", prop->tp_len);
- dict_add_number(dict, "id", prop->tp_id);
+ dict_add_number(dict, "col", (prop->tp_col == MAXCOL) ? 0 : prop->tp_col);
+ if (!virtualtext_prop)
+ {
+ dict_add_number(dict, "length", prop->tp_len);
+ dict_add_number(dict, "id", prop->tp_id);
+ }
dict_add_number(dict, "start", !(prop->tp_flags & TP_FLAG_CONT_PREV));
dict_add_number(dict, "end", !(prop->tp_flags & TP_FLAG_CONT_NEXT));
@@ -990,7 +995,7 @@ prop_fill_dict(dict_T *dict, textprop_T *prop, buf_T *buf)
dict_add_number(dict, "type_bufnr", buf->b_fnum);
else
dict_add_number(dict, "type_bufnr", 0);
- if (prop->tp_id < 0)
+ if (virtualtext_prop)
{
// virtual text property
garray_T *gap = &buf->b_textprop_text;
@@ -1014,6 +1019,8 @@ prop_fill_dict(dict_T *dict, textprop_T *prop, buf_T *buf)
// text_wrap
if (prop->tp_flags & TP_FLAG_WRAP)
dict_add_string(dict, "text_wrap", (char_u *)"wrap");
+ if (prop->tp_padleft != 0)
+ dict_add_number(dict, "text_padding_left", prop->tp_padleft);
}
}