[vim/vim] Fix several bugs in the text property (PR #19869)

14 views
Skip to first unread message

h_east

unread,
Mar 30, 2026, 2:05:38 PM (4 days ago) Mar 30
to vim/vim, Subscribed

Related: #19685 (Since the original PR is no longer being updated due to various reasons, I am taking over the work in this PR.)

Fixes: #19680
Fixes: #19681
Fixes: #12568
Fixes: #19256


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19869

Commit Summary

  • 6fe1675 Fix several bugs in the text property

File Changes

(11 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869@github.com>

h_east

unread,
Mar 30, 2026, 2:59:47 PM (4 days ago) Mar 30
to vim/vim, Push

@h-east pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/6fe1675bef008dd63857eccd3cf7e6ba5db72d43/after/610987112bca19999db52cb1bd10aa378d97709e@github.com>

h_east

unread,
Mar 30, 2026, 3:03:35 PM (4 days ago) Mar 30
to vim/vim, Push

@h-east pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/610987112bca19999db52cb1bd10aa378d97709e/after/4fa1768b2255248bfb249b1e384fc0fcfba1e1b9@github.com>

h_east

unread,
Mar 30, 2026, 3:06:13 PM (4 days ago) Mar 30
to vim/vim, Push

@h-east pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/4fa1768b2255248bfb249b1e384fc0fcfba1e1b9/after/d5e4a0b2416d76022a198963e83a642a1375e951@github.com>

h_east

unread,
Mar 30, 2026, 3:16:35 PM (4 days ago) Mar 30
to vim/vim, Push

@h-east pushed 1 commit.

  • c912d9c Fix expected test value in Test_multiline_substitute_del_lines_drops_virt_text_props() L41


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/d5e4a0b2416d76022a198963e83a642a1375e951/after/c912d9c628f8cc3c5d3008a59cdebc044130bb8b@github.com>

h_east

unread,
Mar 30, 2026, 10:07:50 PM (4 days ago) Mar 30
to vim/vim, Push

@h-east pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/c912d9c628f8cc3c5d3008a59cdebc044130bb8b/after/977b593ae600b2a660951c20f142b267f0d2a86e@github.com>

h_east

unread,
Mar 31, 2026, 9:48:43 AM (3 days ago) Mar 31
to vim/vim, Push

@h-east pushed 2 commits.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/977b593ae600b2a660951c20f142b267f0d2a86e/after/37cb0b468c173ffa0d24d31d4344c173143e3530@github.com>

h_east

unread,
Mar 31, 2026, 10:24:27 AM (3 days ago) Mar 31
to vim/vim, Push

@h-east pushed 4 commits.

  • aedadc0 Fix expected test value in Test_multiline_substitute_del_lines_drops_virt_text_props() L41
  • 69934d8 Fix flaky Test_props_with_text_after_nowrap
  • d29b1f8 Fix by self-review
  • 387b552 Fix CI ASAN error


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/37cb0b468c173ffa0d24d31d4344c173143e3530/after/387b5522bfdb0c366256b57ead39f158f8394778@github.com>

h_east

unread,
Mar 31, 2026, 11:34:24 AM (3 days ago) Mar 31
to vim/vim, Push

@h-east pushed 2 commits.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/387b5522bfdb0c366256b57ead39f158f8394778/after/63468949d8b04177f9fdf2055cd5a59c53a79d4a@github.com>

h_east

unread,
Mar 31, 2026, 12:50:35 PM (3 days ago) Mar 31
to vim/vim, Push

@h-east pushed 2 commits.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/63468949d8b04177f9fdf2055cd5a59c53a79d4a/after/cd1457460f8ca78b406ed0bf360cee5a6ba354e5@github.com>

h_east

unread,
Mar 31, 2026, 2:35:27 PM (3 days ago) Mar 31
to vim/vim, Push

@h-east pushed 2 commits.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/cd1457460f8ca78b406ed0bf360cee5a6ba354e5/after/bc585a1d67a20afa980f8f8832b686e002db7fab@github.com>

h_east

unread,
7:46 PM (2 hours ago) 7:46 PM
to vim/vim, Subscribed
h-east left a comment (vim/vim#19869)

Specification Differences

Item this-pr pr-19685 (#19685)
Virtual text placement types Existing RIGHT / ABOVE / BELOW only (same as master) AFTER, INLINE added
Placement flag scheme Independent bits (same as master) Multi-value encoding using bit4-6 (TP_FLAG_VTEXT_BITS = 0x070)
TP_FLAG_ALIGN_BELOW value 0x040 (same as master) Changed to 0x030 (not compatible)
Inline vtext and start_incl N/A Doc added: controls insertion position
prop_list() return order Unchanged (by starting column and priority) Changed to "by starting column"
Negative ID restriction (E1293/E1339) Unchanged Removed from documentation
PROP_IS_* macros None PROP_IS_VTEXT, PROP_IS_FLOATING, PROP_IS_INLINE, etc.

Behavioral Difference

When a multi-line substitute joins lines 1-3 (1,3 s/e.1\nLine..2\nL/e.1 L/), floating virtual text properties on deleted lines are handled differently:

  • this-pr: vtext props on deleted line 2 are moved to line 1 and preserved. prop_list(1) returns 4.
  • pr-19685: vtext props on deleted line 2 are dropped. prop_list(1) returns 3.

Implementation: Common

  • Virtual text stored directly in memline (b_textprop_text removed)
  • prop_count header (uint16_t) added to memline format: [text][NUL][prop_count][textprop_T...][vtext...]
  • unpacked_memline_T introduced (LOADED / DETACHED / CLOSED states)
  • tp_text_offset / tp_text union added to textprop_T
  • TP_FLAG_DELETED (0x200) added

Implementation: Differences

textprop_T

Item this-pr pr-19685
Union naming Named u (u.tp_text, u.tp_text_offset) Anonymous union (direct tp_text, tp_text_offset)
Union discriminator Explicit TP_FLAG_VTEXT_PTR (0x400) flag TP_FLAG_VTEXT_BITS mask != 0 means vtext
tp_len for vtext STRLEN(vtext) (excluding NUL) vtext size (including NUL)

unpacked_memline_T

Item this-pr pr-19685
Member count 9 12 (next/prev/adjust_flags added)
Adjacent line management None (existing adjust_text_props_for_delete adapted) next/prev linked list for batch processing
prop_size/prop_count type int uint16_t

um_* API

Item this-pr pr-19685
Public function count 10 16
um_pack static (used internally via um_store_changes) public
um_store_changes Yes (auto-save on um_goto_line/um_close) None (caller must explicitly um_pack + ml_replace_len)
um_open_at_detached None Yes
um_extract_props None Yes
um_sort_props None Yes

Other

Item this-pr pr-19685
Internal types adjustres_T only criteria_T, prop_remove_info_T, vtext_T, prop_mod_T added
vtext_T (ref_count) None Defined but unused (future use or leftover)
memline.c changes Minimal (prop_count header adaptation) Rewritten using um_* API (e.g. add_text_props_for_append)
undo.c No changes has_prop_w_flags removed, ML_PROPS_INCLUDED/ML_COPY_LINE constants
Test infrastructure Vim script tests only Python test helper (textprop.py, textprop_support.vim) added
Change size +1,683 / -368 (16 files) +4,300 / -1,433 (38 files)

Design Philosophy

  • this-pr: Conservative approach. Preserves existing code as much as possible, focusing on memline format change and unpacked_memline_T introduction. um_store_changes auto-saves to reduce caller burden.
  • pr-19685: Large-scale refactoring of text property subsystem. Adjacent line linked list, INLINE/AFTER features, public um_pack, designed for future extensibility.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/c4185655436@github.com>

h_east

unread,
7:48 PM (2 hours ago) 7:48 PM
to vim/vim, Push

@h-east pushed 7 commits.

  • 8126316 Fix several bugs in the text property
  • 3ef5aaf Fix expected test value in Test_multiline_substitute_del_lines_drops_virt_text_props() L41
  • 4a578ac Fix flaky Test_props_with_text_after_nowrap
  • 6dff5fb Fix by self-review
  • 5935b42 Fix CI ASAN error
  • 54cda49 Use bool/true/false
  • 8874029 Remove unused b_textprop_text field


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19869/before/bc585a1d67a20afa980f8f8832b686e002db7fab/after/8874029b0b7c3afa1464495e2481e0b6418459da@github.com>

Reply all
Reply to author
Forward
0 new messages