Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing "Custom preview style" triggers exception #7526

Closed
sauliusg opened this issue Mar 13, 2021 · 11 comments · Fixed by #7851
Closed

Editing "Custom preview style" triggers exception #7526

sauliusg opened this issue Mar 13, 2021 · 11 comments · Fixed by #7851
Labels
bug Confirmed bugs or reports that are very likely to be bugs entry-preview

Comments

@sauliusg
Copy link
Contributor

JabRef version 5.2, 5.3 and 100.0.0 (commit 0dd4de7) on Linuxmint-20.1 and LinuxMint-19.3.

Steps to reproduce the behavior:

  1. Go to "Options|Preferences|Entry preview|Customised preview style|Edit"
  2. Start typing new format elements into the text box, e.g.: "\begin{doi}, DOI: \doi\end{doi}" after the "...\end{page}",
  3. The exception is triggered and pops up a window, disrupting the work:
    Screenshot from 2021-03-13 15-57-01

The edit still can be completed, but the box pops up sevral times, interfering with the editing process....

@Siedlerchr Siedlerchr added bug Confirmed bugs or reports that are very likely to be bugs entry-preview labels Mar 13, 2021
@Siedlerchr Siedlerchr added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Mar 13, 2021
@Siedlerchr
Copy link
Member

I took a quick look and it seems there is a listener on text change triggered and the new layout is set
I think it maybe makes sense to do that when the editor area is left or the user pressed save.

RROR org.jabref.gui.FallbackExceptionHandler - Uncaught exception occurred in Thread[JavaFX Application Thread,5,main]
java.lang.StringIndexOutOfBoundsException: Backslash parsing error near 'chapter \chapter HTMLChars<BR>chapter'
	at org.jabref.logic.layout.LayoutHelper.parseField(LayoutHelper.java:261) ~[main/:?]
	at org.jabref.logic.layout.LayoutHelper.parse(LayoutHelper.java:220) ~[main/:?]
	at org.jabref.logic.layout.LayoutHelper.getLayoutFromText(LayoutHelper.java:47) ~[main/:?]
	at org.jabref.logic.layout.TextBasedPreviewLayout.setText(TextBasedPreviewLayout.java:39) ~[main/:?]
	at org.jabref.gui.preferences.preview.PreviewTabViewModel.lambda$0(PreviewTabViewModel.java:97) ~[main/:?]
	at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360) ~[javafx-base-16-mac.jar:?]
	at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80) ~[javafx-base-16-mac.jar:?]
	at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:104) ~[javafx-base-16-mac.jar:?]
	at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:111) ~[javafx-base-16-mac.jar:?]
	at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:145) ~[javafx-base-16-mac.jar:?]
	at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:50) ~[javafx-base-16-mac.jar:?]
	at javafx.beans.property.StringProperty.setValue(StringProperty.java:71) ~[javafx-base-16-mac.jar:?]
	at org.jabref.gui.preferences.preview.PreviewTab.lambda$15(PreviewTab.java:160) ~[main/:?]

@sauliusg
Copy link
Contributor Author

sauliusg commented Mar 14, 2021

I think it maybe makes sense to do that [trigger the listener on text change – S.G.] when the editor area is left

I guess this will cause similar problems for users with "focus follows mouse/sloppy" desktop settings (like mine :), and also for "click to focus" users who start editing the template, and then decide to leave temporarily the text box to copy some text from another window for pasting.

What could be done of course is that the template compiler does run in background and discretely marks the lines with (potential) syntax errors; a function that is similar to IDE GUIs. But this function is not so much necessary and often very annoying; so unless JabRef is destined to become a do-everything-in-the-world IDE, I thing one can safely skip this feature...

.... or the user pressed save.

To me (as a user) this seems the most natural way. An indication of unsaved changes and a confirmation of "Save/Discard changes" would be also handy when the editor tab is being left ...

@nlao1
Copy link

nlao1 commented Mar 14, 2021

Hi, is this still open? I'd like to take it.

@Mehdi-Ayadi
Copy link

Hi, so i followed all the steps to recreate the bug and i had no exception window that oppens so i wanted to know if this issue is persistent on all the systems or no ? cause it may be something system related ?
If yes i would like to solve it !

@calixtus
Copy link
Member

Sorry @Mehdi-Ayadi , but @yinpeiqi already is on this issue, although you are always welcome to team up on this.
Please talk to him if you have a good idea how to solve this issue and please use the linked pull request #7539 to discuss on the idea further.

@wujastyk
Copy link

JabRef 5.3--2021-04-12--e3094ac
Linux 5.4.0-71-generic amd64
Java 15.0.2
JavaFX 16+8

I am seeing an exception when I merely click on a Selected preview style. I don't have to do any more than that. No editing or anything.

image

java.lang.IndexOutOfBoundsException: 431 not in [0, 260)
	at [email protected]/org.reactfx.util.Lists.checkIndex(Unknown Source)
	at [email protected]/org.reactfx.util.Lists.checkIndex(Unknown Source)
	at [email protected]/org.reactfx.collection.MemoizationListImpl.getIfMemoized(Unknown Source)
	at [email protected]/org.fxmisc.flowless.CellListManager.getCellIfPresent(Unknown Source)
	at [email protected]/org.fxmisc.flowless.CellPositioner.getCellIfVisible(Unknown Source)
	at [email protected]/org.fxmisc.flowless.VirtualFlow.getCellIfVisible(Unknown Source)
	at [email protected]/org.fxmisc.richtext.GenericStyledArea.visibleParToAllParIndex(Unknown Source)
	at [email protected]/org.fxmisc.richtext.ViewActions.firstVisibleParToAllParIndex(Unknown Source)
	at [email protected]/org.fxmisc.richtext.LineNumberFactory.deleteParagraphCheck(Unknown Source)
	at [email protected]/org.fxmisc.richtext.LineNumberFactory.lambda$new$1(Unknown Source)
	at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
	at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
	at [email protected]/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at [email protected]/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

brapana added a commit to brapana/jabref that referenced this issue May 18, 2021
brapana added a commit to brapana/jabref that referenced this issue May 18, 2021
@koppor koppor removed the good first issue An issue intended for project-newcomers. Varies in difficulty. label Jun 27, 2021
@koppor
Copy link
Member

koppor commented Jun 27, 2021

@wujastyk May I ask whether in the jabref event log. Are there any other exceptions there? If not, may I ask whether you clicked on "Customized preview style" or at another style?

grafik

@koppor
Copy link
Member

koppor commented Jun 27, 2021

@wujastyk In any case, could you open a separate issue for that? We are working on a fix for the "Edit" functionality, mark that part as fixed, but do not want to lose your input.

@wujastyk
Copy link

wujastyk commented Jun 27, 2021

JabRef 5.3--2021-06-22--b6697fe
Linux 5.4.0-77-generic amd64
Java 16.0.1
JavaFX 16+8

also #7851

The error was the same; the event log was empty; no, I didn't use Customized preview style (only):

image

@k3KAW8Pnf7mkmdSMPHz27
Copy link
Member

@wujastyk I think it relates to how the codeArea is shown/updated. Commenting out

editArea.setParagraphGraphicFactory(LineNumberFactory.get(editArea));
either makes it harder to trigger or removes it.

I find it easiest to trigger switching between customized preview style quickly using the arrow keys.

If you haven't already done so, would you mind opening up an issue on it? I don't think it relates to any of the other exceptions I have seen.

@wujastyk
Copy link

wujastyk commented Jun 28, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs entry-preview
Projects
Archived in project
8 participants