mfontanini / presenterm

A markdown terminal slideshow tool
https://mfontanini.github.io/presenterm/
BSD 2-Clause "Simplified" License
1.19k stars 29 forks source link

feat: handle code overflow #320

Closed mfontanini closed 1 month ago

mfontanini commented 1 month ago

This makes it so that code blocks don't overflow to the right of the code block but instead how you'd expect them to: by creating a new line within the code block rect, properly colored and stuff.

image

Fixes #289

cc @DrunkenToast can you give this a shot? It seems to work well including line counts and all.

DrunkenToast commented 1 month ago

Woah, awesome! Didn't expect for this to be here so soon.

I did manage to break it however. I am fairly sure this is simply because of the padding not being taken into account/incorrectly. Especially since it doesn't happen with output lines where there is no padding.

Examples:

Too small, goes outside box (2x padding): image

Slightly too small, goes inside padding (1x padding): image

Simply too much text (2x padding): image

mfontanini commented 1 month ago

Nice, thanks! I see the issue, I'll need to shuffle some things around. Weird that I resized the screen so many times and never saw this.

mfontanini commented 1 month ago

Alright this is fixed. The only outstanding minor issue is when you shrink the window enough, the text will hit up to the code box's border. e.g. there won't be a 2 space padding at the end (see the the first long long... line in your first image). I can address this separately tho, as it's a smaller issue and this has been a bit of an annoying change.