summaryrefslogtreecommitdiffstats
path: root/src/charset.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/charset.c b/src/charset.c
index 5ae90da..470698f 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -798,6 +798,45 @@ linetabsize(win_T *wp, linenr_T lnum)
ml_get_buf(wp->w_buffer, lnum, FALSE), (colnr_T)MAXCOL);
}
+/*
+ * Like linetabsize(), but excludes 'above'/'after'/'right'/'below' aligned
+ * virtual text, while keeping inline virtual text.
+ */
+ int
+linetabsize_no_outer(win_T *wp, linenr_T lnum)
+{
+#ifndef FEAT_PROP_POPUP
+ return linetabsize(wp, lnum);
+#else
+ chartabsize_T cts;
+ char_u *line = ml_get_buf(wp->w_buffer, lnum, FALSE);
+
+ init_chartabsize_arg(&cts, wp, lnum, 0, line, line);
+
+ if (cts.cts_text_prop_count)
+ {
+ int write_idx = 0;
+ for (int read_idx = 0; read_idx < cts.cts_text_prop_count; read_idx++)
+ {
+ textprop_T *tp = &cts.cts_text_props[read_idx];
+ if (tp->tp_col != MAXCOL)
+ {
+ if (read_idx != write_idx)
+ cts.cts_text_props[write_idx] = *tp;
+ write_idx++;
+ }
+ }
+ cts.cts_text_prop_count = write_idx;
+ if (cts.cts_text_prop_count == 0)
+ VIM_CLEAR(cts.cts_text_props);
+ }
+
+ win_linetabsize_cts(&cts, (colnr_T)MAXCOL);
+ clear_chartabsize_arg(&cts);
+ return (int)cts.cts_vcol;
+#endif
+}
+
void
win_linetabsize_cts(chartabsize_T *cts, colnr_T len)
{
@@ -1318,7 +1357,7 @@ win_lbr_chartabsize(
cts->cts_bri_size = get_breakindent_win(wp, line);
head_mid += cts->cts_bri_size;
}
- if (head_mid > 0 && wcol + size > wp->w_width)
+ if (head_mid > 0)
{
// Calculate effective window width.
int prev_rem = wp->w_width - wcol;