JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.64k stars 2.59k forks source link

@String handling seems broken #12174

Open jspitz opened 2 weeks ago

jspitz commented 2 weeks ago

JabRef version

5.15 (latest release)

Operating system

GNU / Linux

Details on version and operating system

JabRef 5.15--2024-07-10--1eb3493 Linux 6.11.6-2-default amd64 Java 21.0.2 JavaFX 22.0.1+7

Checked with the latest development build (copy version output from About dialog)

Steps to reproduce the behaviour

Trying to use @String constants with JabRef I am facing multiple challenges:

  1. Trying to enter a new string I follow the docs and use the string editor. However, whatever I do, any string name I enter is reset to "NewString" as soon as I leave the widget, and any value reset to empty. So I end up with @String{NewString = {}}
  2. After having fixed this in a text editor (let's say to @String{ffm = {Frankfurt a.\,M.}}) the string is correctly listed in the string editor. But if I want to use it in the location field as advised, namely #ffm#, JabRef wrongly writes location = {#ffm#}, (rather than location = ffm,)
  3. Now if I fix this in the code editor, the location widget keeps on displaying #ffm#; fine. But as soon as I change anything in this entry (say, fill in the langid field), the source changes back to location = {#ffm#}, (and the output is broken)

Unless I have missed something, it looks like this feature is completely broken in this version.

jspitz commented 2 weeks ago

Ad 3. I have just learned that the fields that keep string constants need to be defined in prefs these days. Adding location there solves this issue, although I think this definitely needs to be documented

The string editor problem persists.

Siedlerchr commented 2 weeks ago

@jspitz Try hitting enter after you enter the new String.

jspitz commented 2 weeks ago

@jspitz Try hitting enter after you enter the new String.

Tried that, didn't work

Siedlerchr commented 2 weeks ago

Before you leave the field (after you entered the text), you have to hit enter

jspitz commented 2 weeks ago

Hm, trying again, it does work. Don't know why I failed in the first place. So it's really all about documentation.

jspitz commented 2 weeks ago

(or maybe make the UI a bit more accessible)

Siedlerchr commented 2 weeks ago

Glad it worked! Unfortunately we cannot fix this "commit cell value on enter" as it's a javafx problem but we will try to improve the UI and the docs

koppor commented 2 weeks ago

Glad it worked! Unfortunately we cannot fix this "commit cell value on enter" as it's a javafx problem but we will try to improve the UI and the docs

https://github.com/xzel23/utility/blob/main/utility-fx-controls/src/main/java/com/dua3/utility/fx/controls/TableCellAutoCommit.java ?

Refs https://github.com/JabRef/jabref-issue-melting-pot/issues/683

jspitz commented 1 week ago

I don't know javafx well, but you can you add two line edit widgets (for key and value, respectively) and an Add button on top of the table? That's what I would go for, most probably.