2

When I paste a long block of text in the question editor on SO (and probably other stack exchange sites), it randomly makes the text wrap-around to a new line after a couple of words, but it's a strange new line. When I put the cursor just in front of the new line and press backspace once, the word on the previous line sticks in front of the second line...

Images explaining:

image 1
(source: mediafire.com)

image 2
(source: mediafire.com)

image 3
(source: mediafire.com)

image 4
(source: mediafire.com)

This is especially annoying when trying to format code. I've only just found out about the ctrl+k shortcut, and I am disappointed that it isn't really shown to the user. Also the help says to use the tab key to indent, but this key swaps focus (in Firefox at least).

What does the editor do to long texts exactly? I can't be the only one confused with this...

7
  • 2
    I don't think I understand what you mean. Could you post an example text or a screenshot?
    – Dennis
    May 2, 2012 at 17:36
  • 1
    @Dennis Sorry, I'll look into optimising the question with a more detailed explanation.
    – MarioDS
    May 2, 2012 at 17:38
  • Where does the help say to use the Tab key? (That would be wrong.) I assume it's saying that tabs are fine, like: when pasting code that was indented using tabs. Or Improve backticks help text needs your vote.
    – Arjan
    May 2, 2012 at 17:42
  • 1
    Though I don't understand the problem you're describing, it might be related to having non-breaking spaces (U+00A0) in your paste; see Why do code blocks sometimes not “show” properly? and Indenting markdown with non-regular unicode spaces does not create a correct code block.
    – Arjan
    May 2, 2012 at 17:47
  • @Dennis I updated my question to include images.
    – MarioDS
    May 2, 2012 at 17:53
  • I think @Arjan is right: You probably have some funky whitespace characters in your paste. Could you create an answer here or in the sandbox, so we can check?
    – Dennis
    May 2, 2012 at 18:00
  • If you want to format code, then highlight it and click the image on the toolbar that looks like {}. If you hover over that, you will notice the CTRL-K hint, and the note that {} is for code samples. You could also click the ? button, and follow the advanced help link.
    – Zoredache
    May 2, 2012 at 19:20

2 Answers 2

4

Seems fine to me: it's just that the HTML textarea does not have a horizontal scrollbar, and is not breaking on dots-without-whitespace. Just like here, I don't think that 'System.Security.Permissions.ReflectionPermission would fit on that first line. Try typing a space before ReflectionPermission to see what I mean, like 'System.Security.Permissions. ReflectionPermission.

It is, technically, still one line, that is wrapped in the editor. When formatted as code, then in the preview and the final result you will see one line, and a scrollbar to make the content fit.

Screenshot of regular website.

9
  • but code is supposed to stay on one line for an indefinite length. I just cannot get the first line of the stack trace on the same line without using ctrl+k...
    – MarioDS
    May 2, 2012 at 18:06
  • (Yep, just added that to my answer, Mario.)
    – Arjan
    May 2, 2012 at 18:07
  • Well I'm sorry to tell you that it wasn't like that in the preview, nor in the final version. Whatever I tried doing without using ctrl+k...
    – MarioDS
    May 2, 2012 at 18:08
  • Well, if you add four spaces before [SecurityException then that line is surely formatted code, and hence show the horizontal scrollbar to make the wrapped line fit. But: that is not visible in the editor indeed. That said: posting long stack traces is rarely useful.
    – Arjan
    May 2, 2012 at 18:10
  • In my answer I got it working now... strange... I swear it didn't work in the question. Or I was doing something wrong...
    – MarioDS
    May 2, 2012 at 18:13
  • Still, Mario, your screenshots (nice!) simply show me that you're adding more whitespace between of type and the long 'System.Security.Permissions.ReflectionPermission (you could have typed any other text after of type to see the same effect). And then in the 4th step remove all whitespace, which gives you an even longer type'System.Security.Permissions.ReflectionPermission that just doesn't fit on that first line. I see you wrote you only removed the last added space, but I think you're mistaken there. (Were all spaces selected when you pressed the delete button?)
    – Arjan
    May 2, 2012 at 18:24
  • Yes I'm sure :) I'll remember what I did in my answer to make it work for the future. Thanks for taking the time to explain!
    – MarioDS
    May 2, 2012 at 18:30
  • Final note, you can open the editor and then paste the following into the location bar of your browser to once get horizontal scrollbars: javascript:$("textarea").css("white-space", "nowrap"); (If you're getting security errors, then try adding some more semi-colons to fool the browser. Your browser might also remove the word javascript: to be more secure. But that is really needed.)
    – Arjan
    May 2, 2012 at 18:37
  • That would be handy if absolutely necessary :) thanks!
    – MarioDS
    May 2, 2012 at 18:40
0

Someone asked me to paste it here:

[SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0 System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +31 System.Security.CodeAccessPermission.Demand() +46 System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Type owner, StackCrawlMark& stackMark, Boolean skipVisibility) +166 System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility) +40 NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateDynamicMethod(Type returnType, Type[] argumentTypes) in ReflectionOptimizer.cs:104

Strange thing is that I get this every time with no matter what I pasted...

3
  • Is it not in a code block on purpose? Looks fine to me when its in a code block (CTRL+K)...
    – Lix
    May 2, 2012 at 18:13
  • @Lix I know it works with ctrl+k. I got no more issues now strangely, when trying to format in code, but still the line breaks that are automatically added behave kind of strange...
    – MarioDS
    May 2, 2012 at 18:14
  • These are not really automatically added line breaks, Mario. It's word wrapping. The edit text area cannot have horizontal scrollbars as then regular text would become hard to read. (It's nice to have long paragraphs wrapped over multiple lines.)
    – Arjan
    May 2, 2012 at 18:29

You must log in to answer this question.

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