Code - extra spacing, hard to copy
heyitsforest opened this issue · comments
When asking ChatGPT to generate code, it has an extra space/indent at the start any of the lines that aren't indented.
Seems like it's to do with the ``` code blocks - it's a small issue but makes copy/pasting more difficult. Any tips/workarounds appreciated.
Eg. (* shows where a space is)
*function generateList() {
*}
Looking at the session logs, there's no space:
"content": "Here's the function:\n\njavascript\nfunction generateList() {\n}\n
"
Thanks for making this open source btw!
I also have this issue
That happens because the Rich Markdown renderer uses a padding of 1 character for the code blocks. And that's not configurable.
I opened an issue in the Rich repository (Textualize/rich#3199). I don't know if this will be taken into consideration, because it seems a minor issue, let's see...
I wrote a workaround on #52 that feels nice to me. Instead of messing with the formatting built in to Rich, I added a /copy command that can be used to directly copy the contents of code blocks or whole messages to the clipboard.
#52 is merged, I think this issue can be closed.