locked
Please remove the horizontal scroll bar on code blocks RRS feed

  • General discussion

  • As I say, can you please remove this feature.  It is not helpful, and in fact makes code virtually unreadable.  Please revert the behaviour to wrap code lines that are too long.

    Please!


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    • Changed type Bigteddy Sunday, February 26, 2012 8:55 AM No consensus
    Sunday, February 12, 2012 5:46 PM

All replies

  • We only have so many options for code that is too long, as we can't force people to format the width, it just won't happen:

    • Let it go on and on, breaking the basic ux width
    • Auto wrap code, this breaks the code making it harder to people to re use. The moment we do this, we'll get complaints that it is a sin to arbitrarily wrap code in the wrong place
    • Horizontal Scroll, containing the code, preserving it's intended structure

    Realize I'm not saying we've done all we should do, but I think the scroll is the right approach. Can we make it better? Yes, that is where we need your help. If you can give me some examples or other forum/code type sites that get this right, or much better than we do, I'd like to see them to see how we can improve. Thanks for the suggestion on this, there are beneifts/drawbacks no matter which way we go.



    Community Forums Program Manager

    Sunday, February 12, 2012 8:47 PM
    Answerer
  • The wrapping in the previous editor was also wrong (in the middle of the word, sometimes), but it was better than scrolling. 

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Sunday, February 12, 2012 8:53 PM
    Moderator
  • We heard just as many complaints about wrapping the code and breaking it when people tried to read and easily use it via copy/paste. So again, no obvious answer to this one.

    Community Forums Program Manager

    Monday, February 13, 2012 1:49 AM
    Answerer
  • I'd say, wrapping is better than scrolling. If you can make wrapping a bit intelligent (don't break the word), then it will be better, but IMHO wrapping is better because in the opposite case you simply can not understand the code without extra efforts. I used to just glance at the code to understand it, now I would need to scroll.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Monday, February 13, 2012 4:10 AM
    Moderator
  • Well, Brent, if you won't remove the scroll bar, how about a "Copy Code" button that we can use, to paste it into Notepad where we can  read the code and make sense of it.

    I was in the habit of using a line-continuation character where I knew my code would wrap.  Most languages have line-continuation characters.

    Powershell is suffering most, I think, because we do write long one-liners.  But as Naomi said, I rather have these wrap at arbitary places (breaking the code), than h. scroll, because it's easy to fix in an editor, but it's more important to be able to understand the code while looking at it on this site.

    Naomi mentioned "extra effort".  For me, that extra effort is having to select all, copy, and paste into Notepad, where I can set wrap on.


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)


    • Edited by Bigteddy Monday, February 13, 2012 4:41 AM
    Monday, February 13, 2012 4:40 AM
  • For a good example of unreadability, please see the following post:  Note the Answer, the very last code insert is one long line, impossible to understand as rendered:

    http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/2b6ead97-a5ae-419a-80f3-d2ffbea0fe8e


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Monday, February 13, 2012 6:33 AM
  • For a good example of unreadability, please see the following post:  Note the Answer, the very last code insert is one long line, impossible to understand as rendered:

    http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/2b6ead97-a5ae-419a-80f3-d2ffbea0fe8e


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)


    I agree. But at least the scroll bar does not cover the text, a phenomenon I have seen a number of times. If you are going to place a scrollbar on a text field, at least make sure that it does not hide the text.
    Tuesday, February 14, 2012 4:42 AM
  • I'd rather add a copy code thing than write conditional wrapping logic or go back to getting complaints about broken wrapped code. I'll see if we can get to a copy code, I like that request.

    Community Forums Program Manager

    Tuesday, February 14, 2012 5:43 AM
    Answerer
  • Well, to me it's a partial solution as now I lost the opportunity to understand the code by one glance. 

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Tuesday, February 14, 2012 3:09 PM
    Moderator
  • Well, to me it's a partial solution as now I lost the opportunity to understand the code by one glance. 

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    I agree.  The copy-code idea is really the long way of going about it:  Ok, so it saves us going Ctrl-A, Ctrl-C, but we still need to bring up Notepad (or our code editor), and paste it in there.  It's not really a solution at all.


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Tuesday, February 14, 2012 3:30 PM
  • I'd rather add a copy code thing than write conditional wrapping logic or go back to getting complaints about broken wrapped code. I'll see if we can get to a copy code, I like that request.

    Community Forums Program Manager

    So your preference is to get complaints about unreadability rather than broken wrapped code? Nobody likes a damned if you do damned if you don't situation. Maybe it's time to look for a real solution. How about a code-wrap/scroll toggle button for one example?

    This has always been an issue in newsgroups, where the line-wrapping was even more inconsistent because it was done by whatever newsreader client you used.

    We used to advise people to indent every line of code. after coping into a text editor, any lines wrapped would have the wrapped portions starting in column 1.

    Wednesday, February 15, 2012 3:33 AM
  • I have just discovered that if the horizontal scroll-bar is present, it is not possible to select all the code with a mouse.  You have to use Shift-Arrow-key to select the obscured text, in order to copy it to another editor for readability.

    It actually couldn't be any harder if you tried to make it so.  The code insert window (when the horizontal scroll bar is present), is now just about unusable, from the point of view of reading or copying the code. 


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Wednesday, February 15, 2012 4:30 PM
  • I have un-proposed Ed's proposal, because as far as I'm concerned, the only "answer" would be a committal to include a copy code button for each code insert.  The code insert function is still very buggy, and re-formats plain text code, especially when editing afterwards.

    The whole experience is hit-and-miss, and the site is extremely frustrating to work with now.


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Wednesday, February 15, 2012 4:33 PM
  • The last reply in the message Grant linked is now the following:

    Unfortunately, the recent switch to a fixed-width font for code blocks, which greatly improves readability, and which I applaud, makes this issue worse. Lines that did not wrap in the past are much more likely to cause scroll bars. I consider the use of a fixed width font essential for code.


    Richard Mueller - MVP Directory Services

    Wednesday, February 15, 2012 5:22 PM
    Moderator
  • I have un-proposed Ed's proposal, because as far as I'm concerned, the only "answer" would be a committal to include a copy code button for each code insert.  The code insert function is still very buggy, and re-formats plain text code, especially when editing afterwards.

    The whole experience is hit-and-miss, and the site is extremely frustrating to work with now.


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Well, I think Brent is entering the copy code as a request to put it on the log to implement. That's the best possible scenario here.

    He already made it clear that unfortunately after making numerous attempts, they came to the conclusion that they had to choose scrollbar or truncations, and scrollbar won.

    So I think those two data points are the answer to this thread.

    Please note that we don't always get the answers we want.

    So if the original question was... "Can you remove the scrollbar?"

    ...Then the answer is, "No. Because it solves this other problem that is ten times more annoying. However, we're looking into adding a Copy button since that will help a bit."

    That would be the answer.

     

    However, I gladly admit that you're making excellent points here.

    If you feel that this is more of a discussion thread than a question, I recommend that you change the thread type to Discussion instead.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)




    Friday, February 17, 2012 12:52 AM
    Owner
  • Test:

    011010101010101010101010101000011111101010101010011010101010101010100101001010101010101
    
    0110101010101010101010101
    
    011010101010101010101010101101010101010101010101010110101010101010101010101011010101010101010101010101101010101010101010101010110101010101010101010101
    
    01101010101010101010101010110101010101010101010101
    
    0110101010101010101010101011010101010101010101010101101010101010101010101010110101010101010101010101011010101010101010101010101101010101010101010101010110101010101010101010101011010101010101010101010101101010101010101010101010110101010101010101010101


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Friday, February 17, 2012 1:00 AM
    Owner
  • Test:

    011010101010101010101010101000011111101010101010011010101010101010100101001010101010101
    
    0110101010101010101010101
    
    

    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)


    Truthfully, I think this is a vast improvement. I like the colors, the box around the code, and yes, even the scrollbar. That said, I understand that it's not perfect.

    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Friday, February 17, 2012 1:01 AM
    Owner
  • What about the example I posted where you can't see any of the code when it is one line? I have found many others where the last line of the code is not visible, and you may not know it. For example closing curly braces in PowerShell scripts, which if missed make the code faulty.


    Richard Mueller - MVP Directory Services

    Friday, February 17, 2012 1:01 AM
    Moderator
  • What about the example I posted where you can't see any of the code when it is one line? I have found many others where the last line of the code is not visible, and you may not know it. For example closing curly braces in PowerShell scripts, which if missed make the code faulty.


    Richard Mueller - MVP Directory Services

    I hate saying this, but would you mind opening that as a new question? Is it already it's own thread yet?

    Yes, that's an excellent issue. I actually was looking at that and wondering how you got that. So you're saying any code with only one line on it gets the scroll bar on top of it?

    Test:

    <test>one line of code: 0100110010101010101001010100101011111111111111010000000000000000000000111111111111111111100000000000001001000000000000110101010101111010101</test>


    Love the colors.

    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)



    Friday, February 17, 2012 1:12 AM
    Owner
  • What about the example I posted where you can't see any of the code when it is one line? I have found many others where the last line of the code is not visible, and you may not know it. For example closing curly braces in PowerShell scripts, which if missed make the code faulty.


    Richard Mueller - MVP Directory Services

    I hate saying this, but would you mind opening that as a new question? Is already it's own thread yet?

    Yes, that's an excellent issue. I actually was looking at that and wondering how you got that. So you're saying any code with only one line on it gets the scroll bar on top of it?

    Test:

    <test>one line of code</test>

    Love the colors.

    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    I couldn't reproduce it (in that one attempt). However, I actually remember this being brought up in another thread and a dev saying that he'll fix it. Can you reproduce this issue? If not, there's a good chance that they fixed it.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Friday, February 17, 2012 1:13 AM
    Owner
  • Wow, it has been fixed. The reply I pasted earlier now looks like this:

    Does this mean updates/fixes are happening? Does this explain why some of my issues cannot be reproduced?

    Also, truncation would obviously be unacceptable. And I have seen many cases in the past where line wrapping caused people to manually copy code that was faulty and failed. Overall, I have to say the Insert Code Block feature is much improved (because of the fixed-width fonts). Personally, I try to use line continuations to keep lines short for readability. I've done that for years. Unfortunately, the PowerShell line continuation character is the backtick, which messes up the colorization, but I know that is being worked on. Finally, note that my old problem adding reasons to edits seems to also be fixed.


    Richard Mueller - MVP Directory Services


    Friday, February 17, 2012 1:31 AM
    Moderator
  • Who determines what is 10 times more annoying? To me a need to scroll is 10 times more annoying than wrong wrapping.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Friday, February 17, 2012 1:33 AM
    Moderator
  • Who determines what is 10 times more annoying? To me a need to scroll is 10 times more annoying than wrong wrapping.
    Not for me. Copying a chunk of code I need and pasting into VS and then have to spend a bunch of time figuring out where all the broken wrapping is worse. We did push out a fix on 2/13 and will be pushing out another on 2/23 (or so). It won't address the powershell wrapping or colorization, but it'll fix some other code formatting bugs reported by people last week. 

    Community Forums Program Manager

    Friday, February 17, 2012 3:11 AM
    Answerer
  • Who determines what is 10 times more annoying? To me a need to scroll is 10 times more annoying than wrong wrapping.

    I'm not the person who gets to decide, but I think that wrapping that creates invalid code is absolutely wrong, while having to scroll is an inconvenience. 

    Perhaps there is a difference here between languages where the end of a line has a definite syntactical meaning and those where line breaks can occur anywhere in a statement.

    Friday, February 17, 2012 3:32 AM
  • Who determines what is 10 times more annoying? To me a need to scroll is 10 times more annoying than wrong wrapping.

    Not for me. Copying a chunk of code I need and pasting into VS and then have to spend a bunch of time figuring out where all the broken wrapping is worse. We did push out a fix on 2/13 and will be pushing out another on 2/23 (or so). It won't address the powershell wrapping or colorization, but it'll fix some other code formatting bugs reported by people last week. 

    Community Forums Program Manager

    I think Naomi raised a valid question that deserves an answer. It's fair enough that your opinion differs from hers (and those of a few others of us). You mentioned earlier not wanting to go back to getting compaints about wrapped code which seems to imply something. I just wonder what analysis determines which of two options ahs the greatest support from the community?

    And, also, what of my earlier suggestion to consider a code-wrap/scroll toggle button?

    Friday, February 17, 2012 5:05 AM
  • Naomi N is consistently the top answerer on all Technet forums.  She does an amazing amount of work here.  I think her opinions should be taken very seriously.

    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Friday, February 17, 2012 6:10 AM
  • I mostly answer in T-SQL forum. There I glance on the code and in 80%+ of the cases I can figure out what does it do or what needs to be changed. In 80% of cases I also write code from the top of my head. So, if I can not see the whole code, I will need to spend more time on each question.

    Now, another annoying problem. Usually I start from writing code directly in the body of the message and only when I'm in the middle or almost finished I switch to code view. At this point all my carriage returns are gone and I have to spend time fixing the code.


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Friday, February 17, 2012 2:20 PM
    Moderator
  • If I enter code manually using the "Insert Code Block" feature I often want to refer to other replies in the thread as I type. That is much more difficult now with the thread dimmed out. Naomi's technique is attractive, except for the extra work after conversion to a code block.


    Richard Mueller - MVP Directory Services

    Friday, February 17, 2012 3:01 PM
    Moderator
  • Yes, I just found that also. I was writing a code using Code Block and I needed to copy some text from the original message. Since the code window is now a modal window, I had to re-type myself the whole block of code.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Friday, February 17, 2012 3:04 PM
    Moderator
  • I am really a nobody here. Just a user, but I like the idea of what I put out there being the way I put it out there. I think that I should have that right. If I write a piece of code it should be shown the way I wrote it not the way someone else thinks it should be shown. If I write it so it can be seen on my screen then it should display the way I wrote it on someone elses screen. Or maybe we should go to a bookstore and tell the seller we only buy the artists books if they are formatted so we can scroll off the edge of the book to read it. Then we would know the earth is indeed flat.

    Is it too much to ask for perfection?

    Ed i don't mean to disagree but an answer is only an answer if it is the answer to the questioner's satisfaction. Otherwise the questioner will probably go to another site where she/he is more appreciated. It is not enough that you have the opinion that it is the answer. Also the real answer seems to have been mentioned and everyone thinks it is too hard but "it" in my opinion is the real answer. See partial quote from Brent Serbus ...write conditional wrapping logic.

    Sometimes a true answer is very difficult but after it is complete then you can celebrate.

    So a true fix to me looks like (I don't have to be humble)

    During writing a post or response I click on enter code button.

    This opens in a new window (I like the way it looks) (but also allows me to revisit the thread for whatever purpose I may have)

    I type or paste my code (or format from the window if I included the code there)

    Apply my language

    preview it (the preview shows how it will look on the screen, I would hope)

    It also shows a message when needed that says the following linebreaks were added and shows them in a new color or brackets.

    If I agree with the changes then I can submit, if I don't I can move the breaks as I want them within the ability of the window (cause obviously it needs to fit within the frame of the forum walls)

    How hard would it be to cause whole words to wrap to the next line preceeded by the line break?

    Before you criticise me remember I am your customer and this is what would make your customer happy (maybe).


    Chris Ward

    Friday, February 17, 2012 5:13 PM
  • What about the example I posted where you can't see any of the code when it is one line? I have found many others where the last line of the code is not visible, and you may not know it. For example closing curly braces in PowerShell scripts, which if missed make the code faulty.


    Richard Mueller - MVP Directory Services

    I hate saying this, but would you mind opening that as a new question? Is already it's own thread yet?

    Yes, that's an excellent issue. I actually was looking at that and wondering how you got that. So you're saying any code with only one line on it gets the scroll bar on top of it?

    Test:

    one line of code</test><//test>

    Love the colors.

    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    I couldn't reproduce it (in that one attempt). However, I actually remember this being brought up in another thread and a dev saying that he'll fix it. Can you reproduce this issue? If not, there's a good chance that they fixed it.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    You actually *did* reproduce the problem in that one attempt. It just seems that there is some inconsistency as to how it is rendered to different users on different platforms. Here is how your post looked to me just a few minutes ago:

    To be brutally honest, I find this behaviour, in which no text at all is visible, to be ten times more annoying than the horizontal scroll bar itself.

    Friday, February 17, 2012 9:45 PM
  • To be brutally honest, I find this behaviour, in which no text at all is visible, to be ten times more annoying than the horizontal scroll bar itself.

    Don't see your image, but I can visualize it. =^)

    So then what platform is rendering the scrollbar incorrectly (to overlap the text)?

    I'm using IE9 on Windows 7. What are you using?

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Friday, February 17, 2012 9:49 PM
    Owner
  • Al, my guess is that you are experiencing the same thing I have experienced with other issues. The issue is fixed, but you don't see the fix for some time. Apparently clicking refresh in IE doesn't enable the new code Microsoft is apparently deploying. Sometimes Ctrl-F5 does a better job of refreshing the cache. In my case, I even restarted IE and restarted my computer and I didn't get fixes for awhile.

    Check the reply above where I start with "Wow" and a screen shot from the thread where mjolinor submitted one long line of code. If that is not what you see in the thread, then you haven't received the "fix". Or do you object to how that example looks now? The thread is here:

    http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/2b6ead97-a5ae-419a-80f3-d2ffbea0fe8e

    The reply I refer to is near the bottom dated 2:38 am feb. 15.


    Richard Mueller - MVP Directory Services

    Friday, February 17, 2012 10:45 PM
    Moderator
  • I have just discovered that if the horizontal scroll-bar is present, it is not possible to select all the code with a mouse.  You have to use Shift-Arrow-key to select the obscured text, in order to copy it to another editor for readability.


    Someone should write a user's manual on the functionality being provided.   So far I have found (in IE9):

    1. triple-click selects a line
    2. right-click on the scroll bar gives a menu which allows scrolling (so right-click Right Edge and right-click Left Edge to assure yourself that the triple click worked <w>)
    3. (but you had better hold Shift- when clicking or your selection might get lost)
    4. activating Caret Browsing (F7) is an option to allow precise selection or scrolling by keyboard.

    Sure is quirky.



    ---

    Saturday, February 18, 2012 12:17 AM
  • To be brutally honest, I find this behaviour, in which no text at all is visible, to be ten times more annoying than the horizontal scroll bar itself.

    Don't see your image, but I can visualize it. =^)

    So then what platform is rendering the scrollbar incorrectly (to overlap the text)?

    I'm using IE9 on Windows 7. What are you using?

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    That last reply was from work, where we run IE7 ib XP. At home with IE9 on windows 7 the scroll bar does not obscure the text.

    Oddly, the image looked OK at work after I uploaded it, but at home with IE9 on windows 7 I cannot see it either. So that is either my fault for uploading an overlarge image, or it is another problem with the editor....

    I'll check from work later and let you know on both counts...

    Saturday, February 18, 2012 12:43 AM
  • Take a look at this thread:

    http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/4e855215-2414-4e7a-8fa1-5b90e9cabc52/

    The entry where I quoted code is just one empty horizontal line.  All I did was click "Quote", and that's what it did to the code.


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Sunday, February 19, 2012 5:47 PM
  • Take a look at this thread:

    http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/4e855215-2414-4e7a-8fa1-5b90e9cabc52/

    The entry where I quoted code is just one empty horizontal line.  All I did was click "Quote", and that's what it did to the code.


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    OK, so I am entering this reply to Grant's post of Feb 19 11am mountain standard time. Above the quote, I see Naomi's picture and the date of an earlier reply of hers.

    Anyway, I noticed that quoting can make a line obscured by the scroll bar visible. But I don't seem to be able to scroll enough to see everything I have quoted. For example, as I write this, I can only scroll what I quoted above far enough up to see the link. So to see the entirety of a larger chunk of code, I might have to quote it, submit it, copy and paste and then delete the quote I made just to see the code.

    This is getting ridiculouser and ridiculouser. I tried Richard's suggestion of ctrl-F5, but that has not worked.

    ---
    Al Dunbar

    Sunday, February 19, 2012 6:23 PM
  • This is wild. Grant, this is what I see in your link:

    But all carriage returns have been stripped out, breaking the code. And Al still doesn't see the last line in code blocks. And days after the fix was deployed. In my case I restarted IE and my computer several times and didn't see the fix. The people in Redmond see fixes long before we do.


    Richard Mueller - MVP Directory Services


    Monday, February 20, 2012 12:13 AM
    Moderator
  • I have decided not to use the code insert function at all anymore.  It makes it too difficult, it breaks and distorts the code,  and many times I have to redo my post altogether.

    In future, I will just paste my code straight into the editor.

    That said, I would rather the editor were a pure text editor, instead of an html designer.  Whatever benefits we get from having html in our posts are negated by the extremely buggy behaviour of the editor. 

    If Microsoft can't get the html editor right, go back to text.


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)


    • Edited by Bigteddy Monday, February 20, 2012 4:44 AM
    Monday, February 20, 2012 4:40 AM
  • Who determines what is 10 times more annoying? To me a need to scroll is 10 times more annoying than wrong wrapping.
    Not for me. Copying a chunk of code I need and pasting into VS and then have to spend a bunch of time figuring out where all the broken wrapping is worse. We did push out a fix on 2/13 and will be pushing out another on 2/23 (or so). It won't address the powershell wrapping or colorization, but it'll fix some other code formatting bugs reported by people last week. 

    Community Forums Program Manager

    Brent - thanks for the info.  It is good to know that this is being addressed.

    Some of the issue with the code editor is that it copies teh HTML from  the clipboard.  The code needsto request 'TEXT' from the clipboard.  The old edito di dthis part correctly but the new code is wrong possibly becuase a coder asssumed that a web page wanted of needed HTML.  In this case the code editor must have TEXT as it is going to reformat the pasted content.

    Here is a workaround so pasting works. 

    1.  From Visual Studio and other colorizing editors:

           a. copy to clipboard
           b. paste into notepad
           c. Ctl-A/Ctl-C
           f. Past into the forum code editor.

    2.  For long Powershell lines.

         a. split lines over more than one line using line continuation.  It will display correctly if there is more than one line and lines do not exceed the control maximum width.

    3. Edit control collapses when re-editing a post.

         a.  I have not found a work-around for this bug.  YOu have to delete and recreate the pasted code.

    Examples:

    Long line (note you cannot select teh whole line:

    Fixed long line:

    Get-WMIObject win32_printerdriver | Select-Object name,version | Format-Table name, version -AutoSize | Out-String | Out-File myfile.txt -append
    Get-WMIObject win32_printerdriver | 
       Select-Object name,version | 
       Format-Table name, version -AutoSize | 
       Out-String | 
       Out-File myfile.txt -append

    Now the line displays and can be copied.


    ¯\_(ツ)_/¯




    • Edited by jrv Monday, February 20, 2012 5:48 PM
    Monday, February 20, 2012 5:43 PM
  • Who determines what is 10 times more annoying? To me a need to scroll is 10 times more annoying than wrong wrapping.
    Not for me. Copying a chunk of code I need and pasting into VS and then have to spend a bunch of time figuring out where all the broken wrapping is worse. We did push out a fix on 2/13 and will be pushing out another on 2/23 (or so). It won't address the powershell wrapping or colorization, but it'll fix some other code formatting bugs reported by people last week. 

    Community Forums Program Manager

    Brent - thanks for the info.  It is good to know that this is being addressed.

    Some of the issue with the code editor is that it copies teh HTML from  the clipboard.  The code needsto request 'TEXT' from the clipboard.  The old edito di dthis part correctly but the new code is wrong possibly becuase a coder asssumed that a web page wanted of needed HTML.  In this case the code editor must have TEXT as it is going to reformat the pasted content.

    Here is a workaround so pasting works. 

    1.  From Visual Studio and other colorizing editors:

           a. copy to clipboard
           b. paste into notepad
           c. Ctl-A/Ctl-C
           f. Past into the forum code editor.

    2.  For long Powershell lines.

         a. split lines over more than one line using line continuation.  It will display correctly if there is more than one line and lines do not exceed the control maximum width.

    3. Edit control collapses when re-editing a post.

         a.  I have not found a work-around for this bug.  YOu have to delete and recreate the pasted code.

    Examples:

    Long line (note you cannot select teh whole line:

    Fixed long line:

    Get-WMIObject win32_printerdriver | Select-Object name,version | Format-Table name, version -AutoSize | Out-String | Out-File myfile.txt -append
    Get-WMIObject win32_printerdriver | Select-Object name,version | Format-Table name, version -AutoSize | Out-String | Out-File myfile.txt -append

    Now the line displays and can be copied.


    ¯\_(ツ)_/¯




    This is what happens when we edit a post with a code control. The quoted area collapses the control and all formatting is lost.

    Here is a control that dispalyed correctly when first created but doesn't after teh edit.

    Get-WMIObject win32_printerdriver | Select-Object name,version | Format-Table name, version -AutoSize | Out-String | Out-File myfile.txt -append
    I added this line and saved the control has stripped all paragraphs and line breaks '<br />' maybe..or pewrhaps it loses the style sheet refernce???

    ¯\_(ツ)_/¯



    • Edited by jrv Monday, February 20, 2012 5:52 PM
    Monday, February 20, 2012 5:50 PM
  • I would be surprised if people are copying html in "Insert Code Block". Most people just type into the form, or like me copy and paste pure text from notepad. However, I believe the notepad file must be saved as ANSI rather than Unicode.

    Grant, since last May I have posted most of my code snippets using "Insert HTML". Until recently, "Insert Code Block" did not use a fixed-width font, which I consider essential for code. I've written VBScript programs I use constantly to convert code in a text file into HTML that specifies a Courier font (fixed-width) and maintains all indenting and spacing. I added code to colorize VBScript and PowerShell last October. With the recent updates, the "Insert Code Block" feature may eventually work for me. For now, I am going to use my scripts. I coded them in VBScript because it is still faster for me to develop solutions than in PowerShell. I posted the scripts on my web site here:

    http://www.rlmueller.net/ConvertCodeToHTML.htm

    The colorization in my scripts is not perfect, but it works for me. Especially in PowerShell, if you don't separate keywords and operators with spaces (I always do), my code will be fooled. Hopefully, in the near future this won't be needed. However, in both the forums and the Wiki's, styles are being applied that we do not see.


    Richard Mueller - MVP Directory Services

    Monday, February 20, 2012 6:49 PM
    Moderator
  • Thank, Richard, I'll use that to post my code.  Your code postings are much more readable than the code insert function.

    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Monday, February 20, 2012 7:01 PM
  • Richard, your link to the Powershell code is broken.  The link to the VBS version is fine.

    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Monday, February 20, 2012 7:06 PM
  • Sorry, I just fixed the link and tested it. You may need to refresh.

    Also, I experimented in the technet sandbox earlier today and found that now I can specify a black border and my style is not stripped away, like it was the last few days. At present I output a line before the code, to separate it from the reply, but do not use the border because it messed things up after the last forum update. If this new behavior continues, I may modify the scripts again to use the black border, since it does look better. For now, I'll wait.


    Richard Mueller - MVP Directory Services


    Monday, February 20, 2012 9:20 PM
    Moderator
  • This is the sample of the thread where I can not understand the problem because I don't see the code.

    http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/9ddc7c9d-4fca-4507-8091-ae0fa0554a33


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Wednesday, February 22, 2012 2:46 PM
    Moderator
  • This is the sample of the thread where I can not understand the problem because I don't see the code.

    http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/9ddc7c9d-4fca-4507-8091-ae0fa0554a33


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    What's more, there seems to be no way of copying the entire line of code, in order to paste it into another editor.  I don't know how you can be expected to work with this!


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Wednesday, February 22, 2012 2:51 PM
  • This is the sample of the thread where I can not understand the problem because I don't see the code.

    http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/9ddc7c9d-4fca-4507-8091-ae0fa0554a33


    What's more, there seems to be no way of copying the entire line of code, in order to paste it into another editor.  I don't know how you can be expected to work with this!


    Grant Ward, a.k.a. Bigteddy

    Perhaps the behavior is browser specific, but using Firefox 10.0.2, I was able to click on the link in Naomi's post and copy the entire text from the code windows (both the single line in the first post and the two lines in the third post) and paste them in Notepad.  I agree that you shouldn't have to copy and paste the code, but (and again this may be browser specific) this is an improvment for me on the behaviour of the old editor.  What I saw with the old editor was that long lines would extend past the end of the code window, get hidden in the sidebar on the right and eventually disappear off the edge of the window.

    I don't have anything against automatic wrapping of text in the code window, but I think it needs to be done according to the rules of the coding language. That means only wrapping in places where a newline is allowed, and possibly adding line continuation characters, or converting long literal strings into shorter strings with valid code to concatentate them.  Depending on the language, this could get very complicated.

    Wednesday, February 22, 2012 5:40 PM
  • I believe in the old editor it was automatic wrapping (sometimes in the middle of the sentence). For me (in T-SQL forum) this would be still preferred method of displaying info.

    I haven't tried to copy the text in that thread (I am using Google Chrome), as for me it would take extra efforts and in that case I decided to ignore that thread. That's just showing that with that new functionality in place answering questions became a bit more complex than it was before when I can spot a problem with the quick glance.


    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Wednesday, February 22, 2012 6:42 PM
    Moderator
  • It is interesting to note that in this very long thread, with many opinions, not one member of the community has spoken out in favour of the horizontal scroll-bar.


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Saturday, February 25, 2012 10:43 AM
  • It is interesting to note that in this very long thread, with many opinions, not one member of the community has spoken out in favour of the horizontal scroll-bar.

    Perhaps I wasn't forceful enough. The horizontal scroll bar is an improvement over the behaviour that I saw with the previous forum software, which was that long code lines simply extended past the end of the code window are were literally unreadable. 

    As I said, I don't know why I saw that behaviour while you and Naomi saw something else, but I certainly not in favour of arbitrary wrapping of code that does not respect the rules of the specified coding language. Perhaps wrapping could be provided only for those languages that the forum software can wrap correctly. Now I think of it, could that be what the old forum software did?

    Saturday, February 25, 2012 11:24 AM
  • Sorry, Blackwood.  That's 1 vote in favour.

    My biggest gripe is that if the code scrolls horizontally, it is impossible to copy it in its entirety, in order to test it in another code editor.

    For example, try copying this into your text editor:

    As I said, I don't know why I saw that behaviour while you and Naomi saw something else, but I certainly not in favour of arbitrary wrapping of code that does not respect the rules of the specified coding language. Perhaps wrapping could be provided only for those languages that the forum software can wrap correctly. Now I think of it, could that be what the old forum software did?

    Furthermore, try to understand the sentence in one go!  How anyone can think this is more readable I don't know!


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)


    • Edited by Bigteddy Sunday, February 26, 2012 9:07 AM
    Sunday, February 26, 2012 8:59 AM
  • Before I started to reply, I clicked on the first character in the code window, and dragged the mouse to just below and to the left of the code window and hit Ctrl-Ins to copy the text. I was then able to paste the text in Notepad and have it word-wrapped to fit a fairly narrow window.

    As Notepad does not insert any newline characters in the text, I can copy it back from Notepad to the code editor and it is still one long line.

    As I said, I don't know why I saw that behaviour while you and Naomi saw something else, but I certainly not in favour of arbitrary wrapping of code that does not respect the rules of the specified coding language. Perhaps wrapping could be provided only for those languages that the forum software can wrap correctly. Now I think of it, could that be what the old forum software did?
    

    Sunday, February 26, 2012 2:21 PM
  • To me the extra work required to understand the content of the post is a biggest obstacle. I will probably skip many of the threads now if I can not understand the code from a quick glance.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Sunday, February 26, 2012 3:34 PM
    Moderator
  • To me the extra work required to understand the content of the post is a biggest obstacle. I will probably skip many of the threads now if I can not understand the code from a quick glance.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    In my mind this is the real issue.

    I, too, can use keyboard tricks to select all of teh text and copy it.(doub;e-click, ctl-C). 

    None of this should be necesary if we had a copy button.

    Readability is most imortant.  The control always removes the loast line break. .  The control always removes all line braks whenever you re-edit the post.

    These are bugs and NOT features.  They are unintended behaviors of the Telerik control.  I am certain this will be fixed shortly.

    Patience...


    ¯\_(ツ)_/¯

    Sunday, February 26, 2012 5:58 PM
  • Here is another example:

    http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/326ee03e-9fcf-4853-b279-2d59286664d1/

    Notice, in the fourth reply, the OP says "All I see in your response is a scroll bar."

    Will no-one admit that this is a problem at least, even if you can't fix it?


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    Wednesday, February 29, 2012 5:19 PM
  • BTW, I see your response normally in that thread (no scroll bar). I am using Google Chrome.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Wednesday, February 29, 2012 5:25 PM
    Moderator
  • Here is another example:

    http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/326ee03e-9fcf-4853-b279-2d59286664d1/

    Notice, in the fourth reply, the OP says "All I see in your response is a scroll bar."

    Will no-one admit that this is a problem at least, even if you can't fix it?


    Grant Ward, a.k.a. Bigteddy

    What's new in Powershell 3.0 (Technet Wiki)

    I see the r4sponse with no scroll bar in IE8.  I will try IE 9 later.

    In some cases if you make the browser full screen the scroll bar will go away.  This is an issue with all text boxes that llow scroll bars and so not set a minimum size.  The behavior is nearly identical on all browsers.

    One very long line of code should demonstrate the issue. We will make it even longer and longer and longer and longer longer

    NOw make your browser full screen and note the scroll bars disappear. Shrinking the browser so it crowds the text box will turn on the scroll bar.  This is the normal behavior for a HTML DIV/PRE with scrollbars enebaled and no minimum size set.


    ¯\_(ツ)_/¯


    • Edited by jrv Wednesday, February 29, 2012 5:46 PM
    Wednesday, February 29, 2012 5:44 PM
  • Here is all of the HTML that gewnerates the scroll box.

    .prettyprint{
        overflow-y:hidden;
        overflow-x:auto;
        word-wrap:normal
    }
    <pre class="prettyprint">One very long line of code should demonstrate the issue. </pre>

    You can see it is just a <pre> tag with some scrollbars.  I we were to add aminimum which you can do if you have the IE8/9 Developers toolbar installed you will see that we can force the box to always appear to have more vertical height but that will still not allow the text to be selected when there is  only one line.

    We can alter the HTML dynamically with teh developer bar and it will force a line and allow the code to be easily selected with the mouse or keyboard by adding a default break to the end of the code.

    Like thsi:

    .prettyprint{
        overflow-y:hidden;
        overflow-x:auto;
        word-wrap:normal
    }
    <pre class="prettyprint">One very long line of code should demonstrate the issue.<br /></pre>

    Note the added <br />


    ¯\_(ツ)_/¯

    Wednesday, February 29, 2012 6:00 PM
  • I have to vote my support for improving the insert code on this board. I have been tearing my hair out over this feature. If I spend 10 minutes to improve a bit of code and afterwards I try to post it on the forums the Insert Code button refuses to function. I can click it once, twice or ten times but no response. 

    Then there is the annoying scrollbars that make the text unreadable from time to time. It would be great if a better alternative can be found for this.

    Wednesday, February 29, 2012 6:58 PM
  • I have to vote my support for improving the insert code on this board. I have been tearing my hair out over this feature. If I spend 10 minutes to improve a bit of code and afterwards I try to post it on the forums the Insert Code button refuses to function. I can click it once, twice or ten times but no response. 

    Then there is the annoying scrollbars that make the text unreadable from time to time. It would be great if a better alternative can be found for this.

    The issues you are having with the buttons is liely because of your browser settings.  The button uses javascript to open an overlay.   The issue withteh scrollbar can be elminated by maximizing teh browser.

    I, too, would like to see a 'Copy Code' button to make copying easier.

    Fixing teh one-line issue would help all of this. I susupect MS is waiting for Telerik to update the control.  I susepct teh control is the newer HTML5 aware version and may have some bugs.  Telerik controls usually work extremel;y well once debugged.


    ¯\_(ツ)_/¯

    Wednesday, February 29, 2012 7:11 PM
  • Wednesday, February 29, 2012 10:41 PM