summaryrefslogtreecommitdiffstats
path: root/src/textprop.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-06 13:48:20 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-06 13:48:20 +0100
commit4d91d347e65a5621621ea1e3c97dce2c677ed71d (patch)
tree3c1d98bf2b063c86b5568099208ec2fb69c151fc /src/textprop.c
parent25f40af9d2f04d18c8a276249f2794e83aa5c290 (diff)
patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'v9.0.0151
Problem: A "below" aligned text property does not work with 'nowrap'. Solution: Start a new screen line to display the virtual text. (closes #10851)
Diffstat (limited to 'src/textprop.c')
-rw-r--r--src/textprop.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/textprop.c b/src/textprop.c
index 9e643f7185..2cd85b4221 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -594,6 +594,29 @@ get_text_props(buf_T *buf, linenr_T lnum, char_u **props, int will_change)
return (int)(proplen / sizeof(textprop_T));
}
+/*
+ * Return the number of text properties with "below" alignment in line "lnum".
+ */
+ int
+prop_count_below(buf_T *buf, linenr_T lnum)
+{
+ char_u *props;
+ int count = get_text_props(buf, lnum, &props, FALSE);
+ int result = 0;
+ textprop_T prop;
+ int i;
+
+ if (count == 0)
+ return 0;
+ for (i = 0; i < count; ++i)
+ {
+ mch_memmove(&prop, props + i * sizeof(prop), sizeof(prop));
+ if (prop.tp_col == MAXCOL && (prop.tp_flags & TP_FLAG_ALIGN_BELOW))
+ ++result;
+ }
+ return result;
+}
+
/**
* Return the number of text properties on line "lnum" in the current buffer.
* When "only_starting" is true only text properties starting in this line will