apos entity causing display issue

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
WayneCa
Posts: 50
Joined: Sat Aug 16, 2014 2:13 am

apos entity causing display issue

Post by WayneCa »

I just found there is an update, so I updated TextPad before doing this. I was hoping the update fixed it, but it didn't.

I have this in a document I am editing:

Code: Select all

<SPAN class="spb">//</SPAN>	<SPAN class="spr">if (visptr & lt; &vislist[MAXVISABLE-1])		// don& apos;t let it overflow</SPAN>
<SPAN class="spb">		if (visptr & lt; &vislist[MAXVISIBLE-1])	// don& apos;t let it overflow</SPAN>
But it displays in the window as:

Code: Select all

<SPAN class="spb">//</SPAN>	<SPAN class="spr">if (visptr & lt; &vislist[MAXVISABLE-1])// don& apos;t let it overflow</SPAN>
<SPAN class="spb">		if (visptr & lt; &vislist[MAXVISIBLE-1])// don& apos;t let it overflow</SPAN>
I had to put a space between the & and lt and apos because escaping the &, or using &amp; didn't work. Look at it as though those spaces aren't there. If you're not seeing the issue, the tabs before the // on each of the lines, before don&a pos;t are disappearing. Yet, if you tap the right arrow from just before the //, the cursor moves past the space character and just before the d in don& apos;t. To clarify, the text in question is

Code: Select all

	// don& apos;t
in each of the four lines, and ignore the space between & and apos.

I believe this is a bug in TextPad, and I have no idea how to get around it.
User avatar
AmigoJack
Posts: 490
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

I fully understand your problem and have encountered it rarily in the past. Yes, TextPad's rendering of lines with certain characters can become inconsistent.

One obvious attempt is to switch the font you're currently using to a different one - no matter how much you got used to it, try different ones and see if they can deal better with everything.

Another thing is: nowadays HTML entities have virtually no sense anymore, since UTF-8 can handle all characters - you can directly put non-breaking spaces or apostrophes or whatever into the textfile and the outcome is still the same - entities only exist to circumvent environments where only ASCII editors were available.

Lastly: tick View > Visible Spaces in the menu to make space-like characters visible - this could also slightly modify how it is displayed in the editor. There are also chances your tabs are just at unlucky positions and it looks like they're not handled at all (this can easily be verified by just adding 1-2 letters in front, which would then consume a bit more space, but the text after the tab should jump much more far away.
WayneCa
Posts: 50
Joined: Sat Aug 16, 2014 2:13 am

Post by WayneCa »

AmigoJack wrote:I fully understand your problem and have encountered it rarily in the past. Yes, TextPad's rendering of lines with certain characters can become inconsistent.

One obvious attempt is to switch the font you're currently using to a different one - no matter how much you got used to it, try different ones and see if they can deal better with everything.

Another thing is: nowadays HTML entities have virtually no sense anymore, since UTF-8 can handle all characters - you can directly put non-breaking spaces or apostrophes or whatever into the textfile and the outcome is still the same - entities only exist to circumvent environments where only ASCII editors were available.

Lastly: tick View > Visible Spaces in the menu to make space-like characters visible - this could also slightly modify how it is displayed in the editor. There are also chances your tabs are just at unlucky positions and it looks like they're not handled at all (this can easily be verified by just adding 1-2 letters in front, which would then consume a bit more space, but the text after the tab should jump much more far away.
I will try changing fonts to see what happens. As far as the entities goes, there are times when you don't want the html tag being rendered as a tag, so you have to use the entities for < and >, but I agree that the rest of them are unnecessary for the most part. I am just following the rule that says you should still use the entity for <, > and '. There's a fourth one too, but I don't recall it offhand.

I have the white-space characters being displayed by having the paragraph symbol button clicked while working on these files. In this particular case the little solid triangle that represents a tab character isn't showing up either. Neither is the centered dot that represents a space character just before the d. But only on these lines and nowhere else.
User avatar
AmigoJack
Posts: 490
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

No need to full quote my entire post.
WayneCa wrote:There's a fourth one too
It's &quot;, so one is able to use quotation marks in attributes, too:

Code: Select all

<element attribute="&quot; and can't">3 &lt; 4</element>
<element attribute='use "the" & apos;'>Tom &amp; Jerry</element>
Sure, for *ML (HTML, XML, SGML...) the entities are to not interfere with *ML itself. Plus a fifth entity: &amp; to actually use the character & itself.

On a side note: it's not okay that this forum turns a & apos; (without space) into an actual apostroph.
WayneCa
Posts: 50
Joined: Sat Aug 16, 2014 2:13 am

Post by WayneCa »

I was just being lazy and not editing the quote. Sorry.

I did find the list and, yes, it's 5. However, I have noticed that modern browsers don't seem to have a problem with any of them except &lt; and &gt;, as these are used for tag identifiers. Even & seems to be rendered correctly. That said, I don't know if it's good practice to not use &amp;, &quot; or & apos;.
User avatar
AmigoJack
Posts: 490
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

That's not a TextPad issue anymore.

&amp; must always be used over & because otherwise your *ML is just invalid - no matter what web browsers (in case of HTML or XHTML) will make out of it. You can always check your whole file with https://validator.w3.org/

&quot; and & apos; must be used in attributes, since those are enclosed in either quotation marks or apostrophes themselves - not using them there would confuse any interpreter, since it wouldn't know anymore if that character was meant as content of the attribute or if the whole attribute literal ends, hence my examples. Outside of attributes there's no need to use those entities.

Likewise &lt; and &gt; don't need to be used inside attributes, since their content is not interpreted as *ML anyway - you can safely use <element> in there without invalidating the markup.
WayneCa
Posts: 50
Joined: Sat Aug 16, 2014 2:13 am

Post by WayneCa »

OK, don't get excited. I'm not using any of them in attributes because I don't need to.

I always run my pages through the validator to make sure they validate, so if an entity is needed I will insert it. That said, I haven't run into issues with this because I use entities where needed.

The issue is that & apos; is making TextPad render the line incorrectly, and the use of it is not in an attribute. It is part of the body content. In this case, comments in the code of a C language program.

I am aware that &amp; is used because & is reserved for use with entities. All I was saying is that the browser will render it as & without using &amp; and seems to know the difference between it and an entity declaration. That doesn't mean that I don't use &amp; anyway.

All I really want to know is, is there a workaround or fix that will allow TextPad to render " // don& apos;t" as intended instead of as "// don& apos;t"?

If there isn't, how do I get the coders of TextPad to look into this?

Edit: I just ran a little test. I replaced all occurrences of & apos; with '. Then I put the file through the html5 validator. It came back with no errors or warnings, so I guess that means that the entity is no longer required unless you are using it in an attribute.
User avatar
AmigoJack
Posts: 490
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

I clearly wrote
AmigoJack wrote:&quot; and & apos; ... Outside of attributes there's no need to use those entities.
Both entities aren't "no longer" required - they were never ever required outside of attributes, because there " and ' never had a special meaning - neither in XML, nor in HTML and also never in XHTML.
Post Reply