st-flexipatch icon indicating copy to clipboard operation
st-flexipatch copied to clipboard

[request] Add patch column patch

Open siduck opened this issue 2 years ago • 55 comments

Hi @bakkeby , st cuts text inside it when st's window is resized :/ . Most terminals dont do this. I didnt find any patches for it either.

I found a build which has this issue fixed , seems like it extends the patch column from here.

@BeyondMagic 's build didnt provide any patch for it tho , I found some useful commits https://github.com/BeyondMagic/st/commit/4339de9129d7f61aedd754a7346fe1b49d467738.

( st without patch column and with it (beyondmagic's build) )

https://user-images.githubusercontent.com/59060246/126583806-0b484dac-4be4-4e80-87d8-f6f2c1762a2b.mp4

It would be very nice if there was a patch for this :]

siduck avatar Jul 22 '21 02:07 siduck

My friend made a patch for it https://github.com/coolabhays/st_custom/blob/master/patches/st-columnredraw-20210722-e40efda.diff , it works but sometimes forward scrolling crashes st

https://user-images.githubusercontent.com/59060246/126688484-8b816a47-80ba-4837-830e-bae6339f1de1.mp4

siduck avatar Jul 22 '21 18:07 siduck

FINALLY GOT A PATCH THAT WORKS!

https://github.com/nimaipatel/st/blob/master/patches/7672445bab01cb4e861651dc540566ac22e25812.diff

siduck avatar Jul 25 '21 05:07 siduck

This certainly feels much more convenient, makes you wonder why it's not in st by default, it doesn't add many lines of code.

In practice this is the same feature as provided by the vim browse patch, but without all of the other features that the vim browse patch adds.

bakkeby avatar Jul 26 '21 08:07 bakkeby

This certainly feels much more convenient, makes you wonder why it's not in st by default, it doesn't add many lines of code.

In practice this is the same feature as provided by the vim browse patch, but without all of the other features that the vim browse patch adds.

Vim browse removes the functionality of a rollback iirc , also this patch works unless you resize the window vertically which duplicates the prompt , check the issue in its repo.

siduck avatar Jul 26 '21 08:07 siduck

Maybe there is something special going on with the last lines printed (or the prompt). This is also the case if you don't have this patch though.

bakkeby avatar Jul 26 '21 12:07 bakkeby

@bakkeby if you dont mind , could you update the patch column patch in your free time? Ive seen a build which has this patch and scrolling vertically doesnt cut the text too.

Example : My build ( with patch column patch) and this build(with modified patch column so vertically resizing doesnt cut the text)

https://user-images.githubusercontent.com/59060246/128623827-b89e0d18-f324-4461-89ca-fff98a3185fe.mp4

https://github.com/ashish-yadav11/st/issues/1

siduck avatar Aug 08 '21 07:08 siduck

I saw that build, it is pretty slick. He has done a lot of changes in his build. I'm hoping he'll release a standalone patch at some point, otherwise I'll have to go through all his changes.

I'll get around to this eventually, I have quite a few things in my backlog.

bakkeby avatar Aug 08 '21 07:08 bakkeby

Did you all get far with vertical resizing?

I can finally give a look at it, after all those months.

BeyondMagic avatar Oct 21 '21 03:10 BeyondMagic

Did you all get far with vertical resizing?

I can finally give a look at it, after all those months.

not yet ;(

siduck avatar Oct 21 '21 03:10 siduck

I'm trying to make it work basing on the ashish-yadav11 build, though I don't premise anything.

BeyondMagic avatar Oct 21 '21 17:10 BeyondMagic

Yeah, I'm giving up. His build is coded in a way that is beyond my skills in C.

BeyondMagic avatar Nov 03 '21 04:11 BeyondMagic

Well, the good news is that he hasn't updated his build in the last three months which I take to mean that his work is pretty stable :)

So the build is here:

  • https://github.com/ashish-yadav11/st

Trying it out I see that he added reflow to the main terminal as well.

Looking at the files changed tab here we can see all the custom changes that were made to this repository: https://github.com/ashish-yadav11/st/compare/4536f46cfff50c66a115755def0155d8e246b02f...d84cd16cb66cda5e664d09fe79c1f81a6cc96226

To be honest it is less changes than I expected, but the tricky part is figuring out which changes are relevant and what not.

bakkeby avatar Nov 03 '21 10:11 bakkeby

https://user-images.githubusercontent.com/51831435/140183944-39a98294-1040-41c8-b9da-38661d218bd4.mp4

BeyondMagic avatar Nov 03 '21 20:11 BeyondMagic

I'll post the .diff in 7~ hours, gotta work.

BeyondMagic avatar Nov 03 '21 20:11 BeyondMagic

 st.c st.h x.c: rows and columns patch

Patch extracted from https://github.com/ashish-yadav11/st

NOTE: Patch is applied on a st build with other patches on it, a few to
name are liga/boxdraw/hist_scroll patch, however it's not that hard to
actually make this fit on a unpatched st..., it just take time.
Maybe I'll make one in the next few days for an unpatched st build.

Almost every change there is necessary for the patch to work, so you
can replace the history_scroll patch with this one without fear because
the patch includes both row and columns memory resizing.

https://github.com/BeyondMagic/st/blob/01d7a9dc04203f6fe2410413a038ac1f6c4515fb/column-rows-patch-st-with-liga-box-hist.diff

BeyondMagic avatar Nov 04 '21 02:11 BeyondMagic

@BeyondMagic image ;c

siduck avatar Nov 04 '21 11:11 siduck

I'm surprised it actually got that far on your build.

BeyondMagic avatar Nov 04 '21 17:11 BeyondMagic

I'm surprised it actually got that far on your build.

haha , btw could you make the patch for vanilla st? it'd be easy to patch then . Also you could submit the patch on the site too :D

siduck avatar Nov 04 '21 17:11 siduck

Yeah, it just takes a long time to make it, but I"ll eventually do it.

BeyondMagic avatar Nov 04 '21 17:11 BeyondMagic

@BeyondMagic image ;c

~If it doesn't work, you can either patch the conflicts manually or just wait for the unpatched st patch~

Here's the patch for unpatched st.

https://github.com/BeyondMagic/st/blob/master/patches/columns-rows-reflow-st-unpatched.patch

BeyondMagic avatar Nov 04 '21 18:11 BeyondMagic

@bakkeby I'm also interested in the row-reflow patch. I tried to include the changes in st-flexipatch but it got out of hand very quickly. If possible, could you please have a look at it?

This is just a humble request from my end as it's a really useful feature for a terminal. Still, no problems if you're not feeling like doing it.

UtkarshVerma avatar Dec 24 '21 11:12 UtkarshVerma

Hi guys,

wow I think this is probably the most invasive of all the patches out there. It was more time consuming that I thought it would be.

I have added it on a branch columns_reflow for now as it will likely need some testing.

It may have conflicts with these patches:

VIM_BROWSE_PATCH SCROLLBACK_PATCH KEYBOARDSELECT_PATCH COLUMNS_PATCH SIXEL_PATCH CSI_22_23_PATCH

For the sixel patch as an example the position of sixel images are not adjusted correctly when resizing the terminal window.

The vim browse patch I don't expect it to work.

The rest I don't expect any major issues, but I didn't test them all out.

Seasonal greetings to you all.


Regards,

-Stein

bakkeby avatar Dec 25 '21 21:12 bakkeby

Thanks a lot, Stein. I'll test out the patch and let you know.

UtkarshVerma avatar Dec 26 '21 04:12 UtkarshVerma

I checked out the patch and it works as expected. I'm no longer losing scrollback history on resizing vertically. However, there's an issue with the wrapping of text. It doesn't recover properly sometimes.

https://user-images.githubusercontent.com/31820255/147398921-8c759136-6d99-485a-aed1-02aef2d91c86.mp4

UtkarshVerma avatar Dec 26 '21 04:12 UtkarshVerma

Reopening for visibility.

bakkeby avatar Dec 26 '21 09:12 bakkeby

Hi @UtkarshVerma,

yes I see. There is the same behaviour in @ashish-yadav11's build and @BeyondMagic's build.

Also if you do ls -l and you resize to a single column and then back again to the original size then you should also see that there are less files shown (i.e. it is losing lines).

It also looks like that this is affecting the mouse scrollback patches as well.

bakkeby avatar Dec 26 '21 09:12 bakkeby

I am looking into the issue.

ashish-yadav11 avatar Dec 26 '21 13:12 ashish-yadav11

Apply changes in this commit. That should fix the issue.

ashish-yadav11 avatar Dec 26 '21 15:12 ashish-yadav11

Thanks a bunch @ashish-yadav11, looks like the neofetch glyphs warping works fine now. It still seems to lose data / rows when resizing to a single column, but that is more something that you only do if you are playing around with it / testing.

bakkeby avatar Dec 26 '21 17:12 bakkeby

Can you describe a way to reproduce the single column bug (or show it in a video)?

ashish-yadav11 avatar Dec 26 '21 17:12 ashish-yadav11