AsciidocFX icon indicating copy to clipboard operation
AsciidocFX copied to clipboard

UI: characters lost / hidden / swallowed at end of line in edit window, by the vertical slider? Small problem but confusing.

Open newbie-02 opened this issue 1 year ago • 9 comments

I experience that at the end of some lines touching the right window border
the last character is not or only partly displayed, see attached screenshot
row 2: ... dass das deutliche (n) and near bottom in the green circle:
'Redesignin (g)'
here the hidden characters are partly visible, often they are totally off,
and in consequence the editor has to check against 'false positive typos'.

[edit] Another assumption for the source of problem:
someone forgot to account the space used for the vertical slider?
The issue isn't active for very short texts not needing a slider.
It pops up when the text exceeds the window size and AsciidocFX
adds the slider. [/edit]

Assume confusion between zero-based vs. one based counting.
Evtl. the log from terminal window attached at bottom may help in debugging.

AsciidocFx_swallowed_characters

java.nio.charset.CoderMalfunctionError: java.lang.IllegalArgumentException: newPosition < 0: (10 < 0)
        at java.base/java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:588)
        at morfologik.stemming.BufferUtils.charsToBytes(BufferUtils.java:161)
        at morfologik.speller.Speller.charSequenceToBytes(Speller.java:189)
        at morfologik.speller.Speller.isInDictionary(Speller.java:253)
        at morfologik.speller.Speller.isMisspelled(Speller.java:233)
        at com.kodedu.spell.dictionary.LanguageSpeller.isMisspelled(LanguageSpeller.java:26)
        at com.kodedu.spell.dictionary.DictionaryService.lambda$processTokens$1(DictionaryService.java:88)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at com.kodedu.spell.dictionary.DictionaryService.processTokens(DictionaryService.java:103)
        at com.kodedu.controller.ApplicationController.lambda$processTokens$206(ApplicationController.java:2612)
        at com.kodedu.service.impl.ThreadServiceImpl$1.call(ThreadServiceImpl.java:53)
        at javafx.graphics@21/javafx.concurrent.Task$TaskCallable.call(Task.java:1399)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.lang.VirtualThread.run(VirtualThread.java:311)
Caused by: java.lang.IllegalArgumentException: newPosition < 0: (10 < 0)
        at java.base/java.nio.Buffer.createPositionException(Buffer.java:352)
        at java.base/java.nio.Buffer.position(Buffer.java:327)
        at java.base/java.nio.ByteBuffer.position(ByteBuffer.java:1551)
        at java.base/java.nio.ByteBuffer.position(ByteBuffer.java:285)
        at java.base/sun.nio.cs.UTF_8.updatePositions(UTF_8.java:83)
        at java.base/sun.nio.cs.UTF_8$Encoder.encodeArrayLoopSlow(UTF_8.java:509)
        at java.base/sun.nio.cs.UTF_8$Encoder.encodeArrayLoop(UTF_8.java:461)
        at java.base/sun.nio.cs.UTF_8$Encoder.encodeLoop(UTF_8.java:564)
        at java.base/java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:586)
        ... 25 more
30976461 [] INFO  c.k.e.AsciidocAsciidoctorjConverter - Converted Asciidoc to HTML5 
30981386 [] INFO  c.k.e.AsciidocAsciidoctorjConverter - Converted Asciidoc to HTML5 
`

newbie-02 avatar Dec 15 '23 06:12 newbie-02

I'm not able to reproduce it. I would like to test if you share with me some document

rahmanusta avatar Jan 16 '24 20:01 rahmanusta

hello @rahmanusta, thanks for caring,

the text is simple enough to not upload, see screenshot,

I even cross-checked that it's not an effect of my 4k screen,
see second screenshot with reduced resolution,
only 'requirement' I found is the text in edit window long
enough to activate the slider, then you can pull the edit / preview
border to cover one letter at the tail of row.

asciidocfx_display_problem_01
asciidocfx_display_problem_02

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

There is a similar situation at the right border of the preview window,
but there the left rail of the slider is 'repelling' the text, while in the edit
window it's covering / hiding one digit.

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

Can you share some photos?

rahmanusta avatar Feb 28 '24 20:02 rahmanusta

Did you see the screenshots in my previous posts?
In the edit window 'blablabla blablabla blablabl' and the
trailing 'a' chopped into thirds.

newbie-02 avatar Mar 17 '24 12:03 newbie-02

The issue mentioned was resolved for the editor window. However, I don’t notice the issue about preview

rahmanusta avatar Mar 17 '24 19:03 rahmanusta

It is a similar 'situation', not making an issue because
the other parts ( border / slider ) are repelling the text,
producing 'earlier wrap'.

If you are familiar with the code pls. have a look at #459,
it's much more important an issue, making either 'includes'
or sync between edit and preview useless. IMHO it's some
simple 'miscount', but I don't know where.

newbie-02 avatar Mar 18 '24 05:03 newbie-02

The issue mentioned was resolved for the editor window.

trying 1.8.10 it seems not, see attached screenshot and the covered exclamation marks at the end of lines in edit window. AsciidocFX_characters_covered_by_slider

newbie-02 avatar Jul 01 '24 14:07 newbie-02

In case this has not become clear in the interim, the exception posted at the top featuring the nonsensical complaint newPosition < 0: (10 < 0) indicates illegal concurrent calls to this CharsetEncoder instance by multiple threads. Looking at the source code for Buffer at https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/nio/Buffer.java#L326 we can see the test newPosition > limit | newPosition < 0 fails, where newPosition is 10, but then on constructing the failure report finds that in fact 10 is within the now-changed limit and assumes it must be negative.

As noted at https://docs.oracle.com/javase/7/docs/api/java/nio/charset/CharsetEncoder.html, instances of CharsetEncoder must not be used by multiple concurrent threads.

I found this thread because I just finished troubleshooting the same problem, and this is the only google hit for "CoderMalfunctionError" "newPosition < 0" :D

smowton avatar Aug 14 '24 10:08 smowton