ocpaul20 Posted September 9, 2010 Share Posted September 9, 2010 I have posted a piece of PHP demostrating a problem with thresholding images. When I try and copy it (Like I hope other will do to see what I am talking about), I get 3 newlines in between each statement line. This is probably why I have no replies - but I can handle that... The suggestion is to remind us(me!) that if we want to post code as an illustration of our problem then the bbcode php tag is fine, but if we want others to copy and paste our code, then this method is useless as far as I can see, because of all the extra newlines inserted between statements when pasted into a text editor. This is just a moan and a suggestion, so dont take too much notice of it. :-) Quote Link to comment https://forums.phpfreaks.com/topic/212930-php-help-code-copying/ Share on other sites More sharing options...
JasonLewis Posted September 9, 2010 Share Posted September 9, 2010 It doesn't always do it, at least not for me. Most times it copies correctly, other times it adds in the extra new lines. I put it down to the OPs editor usually. Quote Link to comment https://forums.phpfreaks.com/topic/212930-php-help-code-copying/#findComment-1109054 Share on other sites More sharing options...
ocpaul20 Posted September 9, 2010 Author Share Posted September 9, 2010 On other forums the 'code' bbcode tag works better for me. I use linux and so editors recognise CR and NL as different from windows I suppose. Quote Link to comment https://forums.phpfreaks.com/topic/212930-php-help-code-copying/#findComment-1109415 Share on other sites More sharing options...
DavidAM Posted September 10, 2010 Share Posted September 10, 2010 It seems to me that this happens when there are TAB characters (char(9)) in the code tags. I gather it is the difference between the OP using copy & paste to post the code vs. just typing the code or copying from an editor that has replaced tabs with spaces. It is a pain in the ... rear. There was a time when this did not happen and then there was an update to the forum software and it starting happening. Maybe it has something to do with the javascript on this container and the paste function. All I know is, it is a pain in the ... rear. The first code block below has TAB characters in it. The second code block uses SPACEs // This is just a line all by itself One tab before this line ... None here ... two here // The End // This is just a line all by itself One tab before this line ... None here ... two here // The End I just did a little test, and when I copy the code out of the first box and paste in my favorite editor, it puts one \n (newline) before the first \t (TAB) (that's in addition to the newline that is on the previous line) and TWO newlines ("\n") after EVERY TAB. Did I mention that this is a pain in the ... rear? Quote Link to comment https://forums.phpfreaks.com/topic/212930-php-help-code-copying/#findComment-1109451 Share on other sites More sharing options...
Adam Posted September 10, 2010 Share Posted September 10, 2010 Perhaps suggest to SMF they should incorporate a fix for this in their next release? Quote Link to comment https://forums.phpfreaks.com/topic/212930-php-help-code-copying/#findComment-1109581 Share on other sites More sharing options...
ocpaul20 Posted September 11, 2010 Author Share Posted September 11, 2010 Yes, this would be good to fix. It does seem like it is TABs which make it happen and the example illustrates it very well. Thanks for the explanation Still no reply to my image thresholding problem though - it seems no-one has come across it or has any solution. :-( Quote Link to comment https://forums.phpfreaks.com/topic/212930-php-help-code-copying/#findComment-1110057 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.