bakkeby / st-flexipatch

An st build with preprocessor directives to decide which patches to include during build time
MIT License
353 stars 108 forks source link

[Question] Reflow patch vs St's default reflow patches #135

Closed alipio closed 2 months ago

alipio commented 5 months ago

Hi,

Sorry to bother you, I just want to ask a couple of questions regarding the reflow patch:

  1. What is the difference between this specific patch and all the other patches available on the st site (st-scrollback-reflow-0.9.diff, st-scrollback-reflow-20230607-211964d.diff)? Do they behave the same way?
  2. Do I need the scrollback patch as well? I guess both features were "merged" into the same patch πŸ€”
  3. Theoretically, I could easily reuse the reflow.c/reflow.h files to patch an "unpatched" version of st too (without using st-flexipatch). Am I right?

I'm asking these question because I'm planning to use st and tried some of these patches in a vanilla version but basically all of them dot not apply cleanly, even though st is basically "unpatched" yet. I know you guys have been doing this for so long, so I'm just seeking for a little help here to guide me in some way. Of course, I'll resolve those conflicts if I have to, or just adopt st-flexipatch as a last resort.

Thanks in advance! Keep up the good work!

bakkeby commented 5 months ago

Hi @alipio,

1) What is the difference between this specific patch and all the other patches available on the st site (st-scrollback-reflow-0.9.diff, st-scrollback-reflow-20230607-211964d.diff)? Do they behave the same way?

The patches should in principle behave in the same way, i.e. reflow data when resizing in a similar manner to how it is done when using tmux (st is kind of designed to be used with tmux mind you).

The implementation in st-flexipatch is based on veltza's st-sx build which might be a good place to start rather than patching vanilla st from scratch.

I tried the original patch on a branch columns_reflow two years ago which worked fine but had some issues when resizing the terminal to a single column and back.

2) Do I need the scrollback patch as well? I guess both features were "merged" into the same patch πŸ€”

No scrollback is baked into the reflow patch.

In practice reflow would not make much sense without scrollback.

3) Theoretically, I could easily reuse the reflow.c/reflow.h files to patch an "unpatched" version of st too (without using st-flexipatch). Am I right?

The functions in reflow.c replace functions with the same name in st.c so there would be a lot that you would have to delete manually. There are also quite a few other changes in st.c that would have to be made, so no I don't think that you could just use reflow.c to patch this on a vanilla st.

You do not need to use st-flexipatch, but it may be worth checking as a reference as there may be some integration hints in there that may be of help. The reflow patch specifically do not clash with too many other patches (mostly sixel, openurlonclick and externalpipe).

alipio commented 5 months ago

Hi,

The implementation in st-flexipatch is based on veltza's st-sx build which might be a good place to start rather than patching vanilla st from scratch.

Good to know. I took a look at the veltza's build and it has basically everything I need! 😁

No scrollback is baked into the reflow patch.

In practice reflow would not make much sense without scrollback.

Yeah, I agree πŸ‘πŸ»

The functions in reflow.c replace functions with the same name in st.c so there would be a lot that you would have to delete manually. There are also quite a few other changes in st.c that would have to be made, so no I don't think that you could just use reflow.c to patch this on a vanilla st.

Well, I also did my "homework" (while waiting for an answer) and, to be honest, it worked! I made it! I used the reflow.c/reflow.h pair and removed everything in st.c by hand, plus minor tweaks here and there, constantly checking st-flexipatch as a reference like you suggested (I followed my intuition of couse, because I've just read your answer right now).

You do not need to use st-flexipatch, but it may be worth checking as a reference as there may be some integration hints in there that may be of help. The reflow patch specifically do not clash with too many other patches (mostly sixel, openurlonclick and externalpipe).

πŸ‘πŸ»

Anyways, veltza's build is indeed a good place to start. I learned a lot doing my "experiments", but now it's time to move on!

Thank you so much for answering my questions, I really appreciate it! Have a nice day!