NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Word Wrap and indented lines


Joined: 12 Jun 2007
Posts: 2
Reply with quote
Hi, I just downloaded the trial today and love the software, however there is one thing that sort of bugs me about it and that is the wordwrap.
I have tried to search the web and these forums for an answer but can't seem to find it (that might actually be my answer though).

Basically I am used to using editpluss and love thier wordwrap feature where it auto indents on long lines (so you can clearly see the whitespace to seperate content) but this software doesn't seem to have that. I am confused as it has much more advanced features that this.

Is this in the software but I am just overlooking it? Or will it be in a future update becuase it really can get confusing when looking at code and seeing the end of a long line at the start in a load of white space.

Thanks in advance,

John
View user's profileFind all posts by johnprice99Send private message


Joined: 05 Jan 2005
Posts: 16
Location: Austria
Reply with quote
Quote:
so you can clearly see the whitespace to seperate content

I don't know if "the whitespace" is the same as in editplus, but the word wrapping is here:

View user's profileFind all posts by matSend private messageVisit poster's website
Re: Word Wrap annoyance


Joined: 02 Jan 2007
Posts: 2
Reply with quote
johnprice99 wrote:
wordwrap feature where it auto indents on long lines (so you can clearly see the whitespace to seperate content)


My previous editor was TextPad (textpad.com) which also had that feature. I switched to PHPED a few months ago and love it, but I REALLY MISS that feature. I can't stand how word-wrapped lines wrap all the way to the left, ignoring that line's initial indentation. It makes viewing the code so much easier when wrapping indented code.

Hopefully this is something the devs can add in the near future.
View user's profileFind all posts by thinkspillSend private message


Joined: 12 Jun 2007
Posts: 2
Reply with quote
Hi, thanks for your replies guys.
Maybe I wasn't clear, I do know about the wordwrap but it is just annoying that the wrapped lines start at the very far left.
I too hope this is something that will be added at a later date.

John
View user's profileFind all posts by johnprice99Send private message


Joined: 26 May 2007
Posts: 40
Reply with quote
Having code in lines that are that long that they need to be wrapped is considered bad programming style. PHP will still execute the code fine when you spread it over multiple lines. For example this:
Code:
echo "<form method=\"POST\" action=\"start.php\">\n".
"<p class=\"center\">&nbsp;".
"<input type=\"submit\" name=\"submit\" value=\"Return to Login\" />\n".
"</p>\n".
"</form>\n</body>\n</html>";


works fine. Typically, make sure lines do not get longer than 80 characters. I am not that strict, but take the 80 chars as a guide. I won't break my neck over forcing an 83 character line into two lines. Just as a note, the white spacing that I have in my code doesn't show in the above example. I make it so that the " line up with the " of the first line. AFAIK the 80 chars/line come from the maximum characters per line viewable in terminals and printable on printers using flat ASCII.
View user's profileFind all posts by RamonSSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
btw:
Code:
echo "<form method=\"POST\" action=\"start.php\">\n".
"<p class=\"center\">&nbsp;\n".
"<input type=\"submit\" name=\"submit\" value=\"Return to Login\" />\n".
"</p>\n".
"</form>\n</body>\n</html>";

is the same as

Code:
echo "<form method=\"POST\" action=\"start.php\">
<p class=\"center\">&nbsp;
<input type=\"submit\" name=\"submit\" value=\"Return to Login\" />
</p>
</form>\n</body>\n</html>";


and is the same as

Code:
?><form method="POST" action="start.php">
<p class="center">&nbsp;
<input type="submit" name="submit" value="Return to Login" />
</p>
</form>
</body>
</html><?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 26 May 2007
Posts: 40
Reply with quote
Agreed, I should have picked an example where variables and arrays are used so that the proper string concatenation makes more sense. The last example is probably the best as it does not require the PHP interpreter and thus is about 0.2754 microseconds faster, which doesn't sound much, but can add up. That's what we got the profiler for. Very Happy
View user's profileFind all posts by RamonSSend private message
Veteran

Joined: 26 Dec 2006
Posts: 253
Location: Phoenix, AZ
Reply with quote
RamonS wrote:
Having code in lines that are that long that they need to be wrapped is considered bad programming style.


In general, that's true. But as with most other programming rules, this one isn't absolute. For one thing, there are times when having a line break can break the function of the text; this is pretty uncommon in PHP, but it comes up more often in other files that PhpED can edit, such as HTML. And even when it can be done, it's bad practice to edit existing code for such a silly reason, since there's a good chance that a small mistake in the edits will go unnoticed. Also, there are rare times when one visual line is much easier to follow, even if it means scrolling.

Also, the old rule of thumb about 70-80 characters is just silly in this day and age. No longer are we all programming on similarly sized text-only displays - now we're programming on screens of all different sizes and resolutions, using fonts of all different sizes inside of windows of all different sizes. I've seen programmers who can only get about 30 characters across at once, and I've seen some who can get a few hundred. Most programmers I work with nowadays who don't have some sort of visual disability prefer to work at right around 140, which is easily done on most modern screens (at least those that you'll find programmers typically using). Add in the fact that we may want to resize the editing window for whatever reason, and you quickly see how having the IDE properly maintain indentation on soft-wrapped text is an incredibly useful option.
View user's profileFind all posts by bobwilliamsSend private messageVisit poster's website
Word Wrap and indented lines
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic