MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   [Bug] HTML Comments in Preview (https://www.mobileread.com/forums/showthread.php?t=310110)

Tex2002ans 08-21-2018 07:34 PM

[Bug] HTML Comments in Preview
 
3 Attachment(s)
Versions

Sigil 0.9.10
Windows 10 - 64 bit

(Haven't tested on other OSes or older versions of Sigil)

The Bug

Attached is a sample EPUB.

Let's say you have an HTML file in Code View with an HTML comment in it:

Spoiler:
Code:

<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 4</p>
<p>Paragraph 5</p>
<p>Paragraph 6</p>
<p>Paragraph 7</p>
<p>Paragraph 8</p>
<p>Paragraph 9</p>
<p>Paragraph 10</p>
<p>Paragraph 11</p>
<p>Paragraph 12</p>
<p>Paragraph 13</p>
<p>Paragraph 14</p>

<!--Comment 15-->

<p>Paragraph 15</p>

<p>Paragraph 16</p>
[...]

<p>Paragraph 100</p>



Preview window syncs to each location fine... until you place your cursor on the line With/After the HTML comment on it.

Preview jumps all the way to the top of the file, instead of staying in the vicinity of the nearest <p>.

If you press Line 24, Preview is fine:

Attachment 165779

If you press anywhere in Line 25/26, Preview jumps to the top:

Attachment 165780

Code:

<p>Paragraph 14</p>|Fine
|Fine
<!--Comment 15-->|JumpsToTop
|JumpsToTop
<p>Paragraph 15</p>|Fine
|Fine
<p>Paragraph 16</p>|Fine
[...]
<p>Paragraph 29</p>|Fine
<!-- Comment 30-->|JumpsToTop
<p>Paragraph 30</p>|Fine

What you expect is:

Code:

<p>Paragraph 14</p>|Fine
|Fine
<!--Comment 15-->|StaysSameAsP14
|StaysSameAsP14
<p>Paragraph 15</p>|Fine
|Fine
<p>Paragraph 16</p>|Fine
[...]
<p>Paragraph 29</p>|Fine
<!-- Comment 30-->|StaysSameAsP29
<p>Paragraph 30</p>|Fine


KevinH 08-21-2018 08:20 PM

Yes comments are not actually considered tags inside a node tree in Preview and instead are special text nodes, so extracting a webpath to s comment will result in its parent block tag being used.

Try clicking on an actual tag not a text node.

Tex2002ans 08-22-2018 02:10 AM

I was working on a book yesterday with lots of HTML Comments.

Usually I'm staring at Preview + clicking around in Code View out of the corner of my eye (mousewheel,click mousewheel,click)... and it was just awful having Preview constantly jumping up top.

It also occurred while I was using Find/Replace or spellchecking with Preview open. Imagine:

Code:

[...]
<p>Sample coed</p>
<!-- This is some coed for an HTML Comment ->
<p>And when will I learn how to spell code correctly in my coed.</p>

I was pulling my hair out with how often Preview was jumping to the top of the file.

Note: I just tested my example EPUB in Calibre's Editor, and Calibre acts as expected (no jumping).

Quote:

Originally Posted by KevinH (Post 3739305)
Try clicking on an actual tag not a text node.

Also would be helpful to keep in mind for users who aren't able to accurately click the mouse, or those using the keyboard to navigate. (I know a few users on MobileRead have injured hands).

KevinH 08-22-2018 04:21 PM

Are you talking about clicking in Preview and having CodeView sync closely to a comment that is near that point you clicked (which is what I thought when I first read your post and replied about) or are you clicking in or on a comment in html and watching what Preview does. If it is the latter, then Preview is syncing to the parent tag of the text field/comment which in your example is the body tag. If just use arrow keys or click down one line in CodeView, Preview should happily resync automatically after a short delay. There might be a way to move to the previous sibling tag, but that is not how the code is actually designed nor how Sigil generates html paths currently.

Tex2002ans 08-22-2018 05:48 PM

Quote:

Originally Posted by KevinH (Post 3739614)
Are you talking about clicking in Preview and having CodeView sync closely to a comment that is near that point you clicked (which is what I thought when I first read your post and replied about) or are you clicking in or on a comment in html and watching what Preview does.

Clicking in Code View.

Quote:

Originally Posted by KevinH (Post 3739614)
If just use arrow keys or click down one line in CodeView, Preview should happily resync automatically after a short delay.

And that's the issue. Preview will happily sync to the top of the file if the cursor is on an HTML Comment (Line 25/42) or the blank line after (Line 26).


All times are GMT -4. The time now is 10:31 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.