asciidocfx / AsciidocFX

Asciidoc Editor and Toolchain written with JavaFX 21 (Build PDF, Epub, Mobi and HTML books, documents and slides)
http://www.asciidocfx.com/
Apache License 2.0
1.88k stars 295 forks source link

Preview position is way off when editing long documents #459

Open pmorch opened 4 years ago

pmorch commented 4 years ago

I have a 60+ page word document I converted to asciidoc. When I edit it with AsciidocFX far down in the document, the preview is sometimes correct. But often it starts out correct, and then when I edit a line in the editor, it scrolls away to somewhere different so that the line I'm editing is nowhere on the screen.

Because of this issue, AsciidocFx cannot show edit previews when editing long documents (failed on both the two long documents I've tried), and that reduces the utility of AsciidocFX substantially.

Use this gist to reproduce:

Actual behavior: Notice that the preview is now somewhere completely else. The heading is nowhere in sight.

Expected behavior: I expected that the preview showed the edited heading.

See also these related issues with preview position sync: #391 #392 #383.

rahmanusta commented 3 years ago

Hi, I checked the gist but I see only images. Where can I find the all asciidoc content ?

pmorch commented 3 years ago

I have no idea what happened with this. When I clone the gist, sample.adoc is now 0 bytes. I've since left that job, and don't have the original checkout any longer. I'm pretty sure this will occur with any document with lots of images.

Feel free to close this issue if you don't want to pursue it, since I'm not at that job any longer and don't personally have this itch any longer. But I think it is/was a real issue, at least back in Nov 2019 when I filed it.

Ayowel commented 3 years ago

Still an issue, also very noticeable when browsing a document with numerous includes

newbie-02 commented 10 months ago

Still an issue, also very noticeable when browsing a document with numerous includes [Ayowel]

Experience both problems in 2023 ( images and includes ) and would like it great! if that point could be improved. A disgusting crutch is the possibility of using the search function independently available in both windows with the same term, and a disgusting dysfunction is that so achieved sync is trashed as soon as you scroll in one of the windows.

newbie-02 commented 9 months ago

If I'm right in understanding ... there are 2 passes through the document, and something is calculating wrong line numbers in the second pass. E.g. I had a header sequence fail in row 79, it was warned as:

119228208 [] WARN  asciidoctor - 01_ieee_problems.adoc: line 79: section title out of sequence: expected levels 0 or 1, got level 2 

in the terminal, and a second time as:

119230999 [] WARN  asciidoctor - 01_ieee_problems.adoc: line -919: section title out of sequence: expected levels 0 or 1, got level 2 

line -919, both vanished as I corrected line 79.
Assume that's contributing to the mis-alignment between editor and preview.

reproducible: line count fails for header sequence fails in second pass increase by every active
include behind! the out of sequence header.

newbie-02 commented 7 months ago

poor mans workaround ...

cumbersome, but works to some degree,
definitely better would be if someone has talents to fix the line number scope problem ...

masa300V commented 7 months ago

I use AsciidocFX for big / long documents and my top ".adoc" files are just including sub parts. In this situation, I found it beneficial if I have a software switch to stop synching panes of the ".adoc" editor and the preview.

newbie-02 commented 7 months ago

I find under Settings - Editor Settings - 'Detached Preview', but can't check how it handles the synchronization between Editor and Preview as it leads to a dead end of showing a detached floating window with 'Setting' missing the button to return to 'Preview'. First impression: not yet fully mature.

newbie-02 commented 6 months ago

We do have active development in AsciidocFX, but no programmer is taking this shortcoming seriously? IMHO it's rendering 'include' or preview useless. I'm sure it's only a little flaw ...

rahmanusta commented 6 months ago

What exactly do you want?

newbie-02 commented 6 months ago

A working sync between edit window and preview.
Click somewhere or scroll in edit window -> preview scrolls accordingly,
click or scroll somewhere in preview -> edit scrolls accordingly.
Acc. initial post it suffers in long documents,
acc. following in documents with images,
acc. following esp. in files with numerous includes,
in one point I saw that there is different numbering in
two passes over the document when rendering to html.

newbie-02 commented 5 months ago

made you two testfiles to reproduce issue, rename to *.adoc ( github sucks ) and follow instructions in testfile_for_edit_preview_sync.adoc.

testfile_for_edit_preview_sync.adoc.txt dummy.adoc.txt

newbie-02 commented 4 months ago

from the comment on 2024-01-14:

poor mans workaround ... ....
cumbersome, but works to some degree, definitely better would be if someone has talents to fix the line number scope problem ...

It doesn't work for chapter numbering if one of the includes introduces a new chapter :-(

newbie-02 commented 4 months ago

pmorch wrote:

I have a 60+ page word document I converted to asciidoc. ... Use this gist to reproduce:

The gist seems dysfunctional, as well 'download zip' as 'clone https' brings most files zero bytes, in particular sample.adoc. As the issue isn't resolved I'd propose to repair.

newbie-02 commented 4 months ago

catched a flavour of mis-counting line numbers,
In a document with deactivated includes and a sequence
fail in headers I get two announcements for line 1258 in
the terminal, whenever the document is re-rendered.
Activating an include before! the fail keeps line numbers
and still comments line 1258 two times, activating an include
behind! the fail makes one complaint about line 1258, and a
second one wrongly counting it as line 1225.

13654964 [] INFO  asciidoctor - possible invalid reference: gnu01 
13654965 [] INFO  asciidoctor - possible invalid reference: pyt03 
13655054 [] INFO  c.k.e.AsciidocAsciidoctorjConverter - Converted Asciidoc to HTML5 
13655324 [] WARN  asciidoctor - 04_ieee_854_arith.adoc: line 1258: section title out of sequence: expected level 2, got level 3 
13655468 [] INFO  asciidoctor - possible invalid reference: ica00 
13655472 [] INFO  asciidoctor - possible invalid reference: sam01 
... 
13655732 [] INFO  asciidoctor - possible invalid reference: gnu01 
13655733 [] INFO  asciidoctor - possible invalid reference: pyt03 
13656021 [] WARN  asciidoctor - 04_ieee_854_arith.adoc: line 1258: section title out of sequence: expected level 2, got level 3 
13656119 [] INFO  asciidoctor - possible invalid reference: ica00 
13656126 [] INFO  asciidoctor - possible invalid reference: sam01 

after activating an include before line 1258 produces fail list with the same line numbering, 

activating an include behind! line 1258 produces different output:  

33314048 [] INFO  asciidoctor - possible invalid reference: gnu01 
33314053 [] INFO  asciidoctor - possible invalid reference: pyt03 
33314229 [] INFO  c.k.e.AsciidocAsciidoctorjConverter - Converted Asciidoc to HTML5 
33314596 [] WARN  asciidoctor - 04_ieee_854_arith.adoc: line 1258: section title out of sequence: expected level 2, got level 3 
33314694 [] INFO  asciidoctor - possible invalid reference: ica00 
33314696 [] INFO  asciidoctor - possible invalid reference: sam01 
...   
33315586 [] INFO  asciidoctor - possible invalid reference: gnu01 
33315590 [] INFO  asciidoctor - possible invalid reference: pyt03 
33316085 [] WARN  asciidoctor - 04_ieee_854_arith.adoc: line 1225: section title out of sequence: expected level 2, got level 3 
33316213 [] INFO  asciidoctor - possible invalid reference: ica00 
33316216 [] INFO  asciidoctor - possible invalid reference: sam01 

in the assumed second run line 1258 is counted as 1225. An indication that something in counting is out of order, which - IMHO - might contribute to mis-aligning between edit and preview.

newbie-02 commented 3 months ago

@rahmanusta : when working on this it could be benefit to think of the following situation:

while they are out of sync it's tedious word compare work to even find the position in the work you are writing to, with a 'sync mode' e.g. having a horizontal yellow textmarker highlighting row across the screen, and all 4 panes synced to this line it would be much easier to see:

Evtl. such can even speed up rendering as that could be shrinked to the area visible on screen.

newbie-02 commented 1 month ago

On first glance ver. 1.8.10 solves this problem ... thank you very much. :-)

newbie-02 commented 1 month ago

@pmorch, @Ayowel, @masa300V, would you like to recheck and comment if this issue is solved?