What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 129 Stack Exchange communities.

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 ?

share|improve this question

marked as duplicate by Antony, Shadow 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

2 Answers 2

up vote 1 down vote accepted

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.
share|improve this answer
    
I do the same thing. –  Johnny Bones Dec 11 '13 at 14:19

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.

share|improve this answer
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 .