Jump to content

PHP Help code copying


Recommended Posts

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. :-)

Link to comment
https://forums.phpfreaks.com/topic/212930-php-help-code-copying/
Share on other sites

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?

 

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. :-(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.