AsciidocFX icon indicating copy to clipboard operation
AsciidocFX copied to clipboard

Preview position is way off when editing long documents

Open pmorch opened this issue 6 years ago • 18 comments

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:

  • Open sample.adoc from the gist
  • View the "Outline"
  • Click on the "H1 - This is a new heading" heading
    • Notice that the editor goes to that heading but that preview stays at the top of the document (which is rather confusing).
  • Press arrow down, then arrow up
    • The editor returns to that header, and the preview now also shows that heading
  • Append "foobar" to that heading

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.

pmorch avatar Nov 28 '19 18:11 pmorch

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

rahmanusta avatar Mar 21 '21 10:03 rahmanusta

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.

pmorch avatar Mar 21 '21 11:03 pmorch

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

Ayowel avatar Mar 24 '21 21:03 Ayowel

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 avatar Oct 27 '23 11:10 newbie-02

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 avatar Nov 21 '23 16:11 newbie-02

poor mans workaround ...

  • create your includes,
  • check them,
  • for further edits: search and replace include:: by /// include:: and get some sync between edit and preview,
  • to check / release the document in entirety: search and replace /// include:: by include::

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

newbie-02 avatar Jan 14 '24 17:01 newbie-02

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.

masa300V avatar Jan 14 '24 17:01 masa300V

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 avatar Jan 14 '24 20:01 newbie-02

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

newbie-02 avatar Feb 15 '24 23:02 newbie-02

What exactly do you want?

rahmanusta avatar Feb 17 '24 15:02 rahmanusta

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 avatar Feb 18 '24 15:02 newbie-02

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 avatar Mar 19 '24 14:03 newbie-02

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 avatar Mar 28 '24 14:03 newbie-02

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 avatar Mar 29 '24 04:03 newbie-02

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 avatar Apr 15 '24 06:04 newbie-02