When a Kagi Assistant response contains code, the code block has a small toolbar at the top with icons, including one to copy the code to the clipboard. This works well for short snippets. For long code blocks (hundreds or thousands of lines), the toolbar scrolls out of view as soon as I read down the block. To copy the whole block, I have to scroll all the way back up to the top of the response and then click the copy button.
I would like a copy control at the bottom of each code block as well, so I can copy the entire block as soon as I reach the end of it.
Suggested behaviour:
- Show a slim footer bar at the bottom of the code block with at least the Copy button.
- Make it look different from the top bar, for example a smaller bar with just the copy icon and a "Copy" label, so it doesn't look cluttered or duplicated.
- Only show it when the block is long enough to need scrolling (for example, taller than about one screen or more than 30 lines). Short snippets would stay exactly as they are.
- It should copy the entire code block, exactly like the top button.
Impact on existing workflows:
- Nothing changes for short code blocks or for people who use the top button.
- People working with long generated files, scripts or configs save a lot of scrolling and time.
Example scenario:
- I ask the Assistant to write or refactor a large script, and it returns a code block of 800 lines.
- I read or scroll down to the end of the block to check the result.
- The top toolbar, with its copy button, is now hundreds of lines above me.
- Currently, I have to scroll all the way back up, find the toolbar and click Copy.
- With this feature, a Copy button appears in a footer at the bottom of the block. I click it and the whole block is copied, with no re-scrolling.
Possible implementations (any one would solve this):
- A. A footer bar at the bottom of the code block with a Copy button (preferred, simplest and most predictable).
- B. A sticky top toolbar that stays pinned to the top of the viewport while any part of the code block is on screen (like the sticky headers in GitHub's file view). This would also cover the case where I'm in the middle of the block.
- C. A small floating Copy button that appears in the corner of the code block while it is on screen.
Other apps that do something similar:
- GitHub keeps a copy button available on code blocks and file views.
- Some chat and documentation tools show a copy button that stays visible, or repeat it in a footer, for long blocks.
Extras worth considering:
- Show a brief "Copied!" confirmation after clicking, so I know it worked from the bottom of a long block.
- Make the new button reachable by keyboard and give it an accessible label such as "Copy code block", so it works with screen readers.
- If the top toolbar has other icons (for example wrap or download), the footer could include just Copy to stay minimal.