Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter xer21

    (@xer21)

    Thank you very much.

    Thread Starter xer21

    (@xer21)

    redcocker,
    I checked Alex’s site, and it appears someone provided a fix last month and he merged it with his code. However the build is not updated and I couldnt find the source. They said the fix was in the “shCore.js” file in function eachLine, the fix was to change

    return lines.join(‘\n’);
    to
    return lines.join(‘\r\n’);

    but I’m not sure if that will work or not I have not tested it.

    Thread Starter xer21

    (@xer21)

    redcocker,
    Thanks for the reply. As for #1 when you copy from visual studio all new lines are defined with CRLF or in other words, \r\n is the newline identifier. So unfortunitely Alex’s code puts two lines for each 1 newline you paste in. In your code though you can prevent that by checking for [\r]?\n which means \r is optional and it will replace both \r\n and \n with

    Oops, the code that got posted from me removed the <br> so the proper code is
    var code = document.getElementById('shtb_box_code').value.replace(/</g,'<').replace(/[\r]?\n/g,'<br>');

    Sorry for the confusion on that.

    For #2 I’m still messing with that fix that I made because then word wrapping wasn’t working properly after I changed that. Basically what the problem is, I select the text hit ctrl-c to copy the text and when you paste it there is no \n or \r\n so all the text in the box is output as 1 big line.

Viewing 3 replies - 1 through 3 (of 3 total)