Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.