1

This question already has an answer here:

Some questions contain long code listings, and it is often required to copy, download, or view the code in full, and maybe past/download it to a local file for compiler experiments.

Is there a better way for getting the code than doing tedious region select, scroll, and copy ?

Does it make sense to suggest some download link, or maybe copy link similar to the box appearing when pressing share for question or answer?; and how to make such a suggestion ?

marked as duplicate by Antony, Shadow The Dragon Wizard, Richard Tingle, Hugo Dozois, Lance Roberts Dec 11 '13 at 17:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • There are about 3 potential duplicates in the Related widget ------------------> – brasofilo Dec 11 '13 at 12:44
  • @brasofilo and Antony: OK, my searches missed relevant keywords; I will close the question ASAP. – Morten Zilmer Dec 11 '13 at 12:54
1

As you say, sometimes there can be a lot of code. The way I copy it is:

  1. Click Edit on the question, so I can view the markdown
  2. Copy the bits that I need from the raw source (CTRL+A, CTRL+C works too)
  3. Click Cancel to discard the edit.
  4. Then I just paste into my favorite editor.
  • I do the same thing. – Johnny Bones Dec 11 '13 at 14:19
2

Download links are inconsistent with building up a standalone Q&A coding knowledge base.

Plus questions should submit a "Short Self-Contained Code Example". This therefore will be short and ought not to scroll.

So for a well-formed question this will not be a problem.

  • 2
    Sometimes it is very helpful to get longer code listings, for example to get the test bench that shows the problem in source code, so I don't think long code listings and standalone Q&A coding knowledge base are contradicting concepts. – Morten Zilmer Dec 11 '13 at 12:56
  • @mortenZdk 95% of the time a full example can still be short if it's cut down as much as possible – Richard Tingle Dec 11 '13 at 12:58
  • But providing special tools to cover what are essentially edge cases would only encourage large code samples to be submitted in many other cases. – Bathsheba Dec 11 '13 at 12:58

Not the answer you're looking for? Browse other questions tagged .