a copy-button inside a code-block

a copy-button inside a code-block, so that i can copy the code from the code-block without selecting the code.

12 Likes

I’m having a lot of inline code for documenting commands.

I would really like a way to select the code, which would make it more easier for copy and pasting.

Like a double click on the inline code to select, but double click is normally selecting a whole word.

If thats not possible, maybe double clicking at the end of inline code?

@kEbZeCK yeah I had this problem too (multiline batch snippets for example)

Another Idea would be a copy icon in a corner which copies the whole block, could later be extended with a “format” button which indents the code and so on :slight_smile:

2 Likes

@wemiprog A copy icon sounds even better :+1:

1 Like

@wemiprog Please have a look here, it looks the same:

https://community.anytype.io/t/-/1174

1 Like

@Michael Ah yes. Than this one can be closed then.

And also for inline code.

In the meantime you can just use normal keyboard shortcuts of Ctrl-A (select all) and Ctrl-C. And that works for any block. Honestly since that already exists, I am a bit skeptical of the need for a dedicated code block copy option. But give it a try and see what you think. It works as long as that block is already selected for editing. With no block selected it will instead select all blocks.

I agree with Oshyan, the copy button could be good for people not knowing about CtrlA + CtrlC, but in my eyes that is a very small group. Especially when we are talking about the code block. People who writes code genreally know some keyboard shortcuts, at least that is what I think.

1 Like

@Oshyan @Isak

Indeed, it would be nice to have, but not a really must have.

There are other feature request there are more important :wink:

1 Like

Ctrl+A + Ctrl+C only works, when u have the code in a seperate block. But especially when using inline code, thats often not the case.

If the button isnt wanted. I would be happy with any kind of shortcut, as mentioned above.