set_indent() adjusts text properties without any present by jvoisin · Pull Request #21310 · vim/vim · GitHub
Skip to content

set_indent() adjusts text properties without any present - #21310

Closed
jvoisin wants to merge 1 commit into
vim:masterfrom
jvoisin:indent
Closed

jvoisin wants to merge 1 commit into
vim:masterfrom
jvoisin:indent

Conversation

@jvoisin

@jvoisin jvoisin commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Problem: set_indent() calls adjust_prop_columns() on every indent change
even when the buffer has no text properties, unlike all other
callers, wasting a memline unpack per line.
Solution: Guard the call with curbuf->b_has_textprop.

adjust_prop_columns() unpacks the memline entry for the line (um_open_at) before it checks that there is nothing to adjust, so on a buffer without text properties every ">", "<", "=" or autoindent paid for that unpack. Every other caller guards the call with b_has_textprop; set_indent() was the only one that did not.

Problem:  set_indent() calls adjust_prop_columns() on every indent change
          even when the buffer has no text properties, unlike all other
          callers, wasting a memline unpack per line.
Solution: Guard the call with curbuf->b_has_textprop.

adjust_prop_columns() unpacks the memline entry for the line (um_open_at)
before it checks that there is nothing to adjust, so on a buffer without
text properties every ">", "<", "=" or autoindent paid for that unpack.
Every other caller guards the call with b_has_textprop; set_indent() was the
only one that did not.

Signed-off-by: Julien Voisin <julien.voisin@dustri.org>
@chrisbra

Copy link
Copy Markdown
Member

@chrisbra chrisbra closed this in d29b1e1 Sep 15, 2026
@jvoisin
jvoisin deleted the indent branch September 15, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants