[vim/vim] foldtext not reversed and cut off for rightleft (PR #19220)

13 views
Skip to first unread message

Sergey Vlasov

unread,
Jan 19, 2026, 5:05:44 PM (4 days ago) Jan 19
to vim/vim, Subscribed

This fixes fold text rendering when 'rightleft' enabled:

  • text is not reversed
  • text is trimmed in the middle

Before:
image.png (view on web)

After:
image.png (view on web)

closes: #2659


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

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

Commit Summary

  • 068e227 foldtext not reversed and cut off for rightleft

File Changes

(4 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/19220@github.com>

zeertzjq

unread,
Jan 19, 2026, 5:09:31 PM (4 days ago) Jan 19
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/testdir/test_fold.vim:

> +  if !has('rightleft')
+    return
+  endif
+

CheckFeature rightleft


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/19220/review/3679752588@github.com>

Sergey Vlasov

unread,
Jan 19, 2026, 5:40:59 PM (4 days ago) Jan 19
to vim/vim, Push

@noscript pushed 1 commit.

  • e02293e foldtext not reversed and cut off for rightleft


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19220/before/068e227486c71dd2a54136dbbcb6d09b4aa28a01/after/e02293ee1078003d2234a25c09ad6e8527bd6d86@github.com>

Sergey Vlasov

unread,
Jan 19, 2026, 5:41:20 PM (4 days ago) Jan 19
to vim/vim, Subscribed

@noscript commented on this pull request.


In src/testdir/test_fold.vim:

> +  if !has('rightleft')
+    return
+  endif
+

Fixed.


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/19220/review/3679796212@github.com>

Christian Brabandt

unread,
Jan 20, 2026, 2:30:44 PM (3 days ago) Jan 20
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19220)

Thanks. Instead on only relying on the screen dump test, can you also add a test and use foldtextresult() to validate the result is correct?


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/19220/c3774583089@github.com>

Sergey Vlasov

unread,
Jan 20, 2026, 2:48:08 PM (3 days ago) Jan 20
to vim/vim, Push

@noscript pushed 1 commit.

  • f42ab36 foldtext not reversed and cut off for rightleft

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19220/before/e02293ee1078003d2234a25c09ad6e8527bd6d86/after/f42ab36e5765f7976e86cf8ac885260c1d5814a1@github.com>

Sergey Vlasov

unread,
Jan 20, 2026, 2:50:10 PM (3 days ago) Jan 20
to vim/vim, Subscribed
noscript left a comment (vim/vim#19220)

Added foldtextresult() test. Just in case, 'rightleft' does not affect foldtextresult().


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/19220/c3774654880@github.com>

Christian Brabandt

unread,
Jan 20, 2026, 2:55:40 PM (3 days ago) Jan 20
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19220)

oh it doesn't? That sounds wrong.


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/19220/c3774673206@github.com>

Sergey Vlasov

unread,
Jan 20, 2026, 2:58:07 PM (3 days ago) Jan 20
to vim/vim, Subscribed
noscript left a comment (vim/vim#19220)

My expectation is that 'rightleft' only affects the rendering. So if any tool depends on foldtextresult() output, it would be unaffected.

But I don't mind fixing foldtextresult() as well.


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/19220/c3774680833@github.com>

zeertzjq

unread,
Jan 20, 2026, 5:25:42 PM (3 days ago) Jan 20
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#19220)

My expectation is that 'rightleft' only affects the rendering. So if any tool depends on foldtextresult() output, it would be unaffected.

My bad, foldtextresult() documentation says it returns the displayed text. So I need to fix it too.

I think that will break the TOhtml plugin. At two places it uses foldtextresult() with the default 'foldtext' to determine fold level. It's possible that other plugins may use foldtextresult() for this purpose too.


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/19220/c3775235480@github.com>

Christian Brabandt

unread,
Jan 21, 2026, 5:08:02 AM (2 days ago) Jan 21
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19220)

But the whole purpose of TOhtml is to create a html page that looks like what is displayed in Vim. So foldtextresult() should return reversed text, no?


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/19220/c3777233422@github.com>

zeertzjq

unread,
Jan 21, 2026, 5:11:24 AM (2 days ago) Jan 21
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#19220)

Yes, but not every foldtextresult() call in TOhtml is for displaying.


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/19220/c3777248154@github.com>

Christian Brabandt

unread,
Jan 21, 2026, 5:14:07 AM (2 days ago) Jan 21
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19220)

Alright, then skip foldtextresult() for now.


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/19220/c3777259935@github.com>

Sergey Vlasov

unread,
Jan 21, 2026, 1:50:10 PM (2 days ago) Jan 21
to vim/vim, Subscribed
noscript left a comment (vim/vim#19220)

Should I drop foldtextresult() test?


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/19220/c3780596084@github.com>

Christian Brabandt

unread,
Jan 21, 2026, 2:48:17 PM (2 days ago) Jan 21
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19220)

that is fine, thanks


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/19220/c3780837612@github.com>

Christian Brabandt

unread,
Jan 21, 2026, 2:54:07 PM (2 days ago) Jan 21
to vim/vim, Subscribed

Closed #19220 via b51ac5e.


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/19220/issue_event/22197789845@github.com>

Reply all
Reply to author
Forward
0 new messages