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

Fixes StringIndexOutOfBoundsException when cutting text #5776

Merged
merged 6 commits into from
Dec 23, 2019
Merged

Conversation

tobiasdiez
Copy link
Member

@tobiasdiez tobiasdiez commented Dec 21, 2019

There is a bug in the jdk that adding a listener to the selectedTextProperty leads to StringIndexOutOfBoundsException when cutting / deleting text from the field: https://bugs.openjdk.java.net/browse/JDK-8176270

This is the reason for #5708. I fixed it by uncommenting the problematic code, which was related to the X11 support. @davidemdot @koppor How important is this code for X11? Is there a workaround that does not add a listener to selectedTextProperty?

Fixes #5708.

@@ -66,11 +66,13 @@ public ClipBoardManager(Clipboard clipboard, java.awt.datatransfer.Clipboard pri
* @see <a href="https://unix.stackexchange.com/questions/139191/whats-the-difference-between-primary-selection-and-clipboard-buffer/139193#139193">Longer text over clipboards</a>
*/
public static void addX11Support(TextInputControl input) {
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a link to the jdk bug, so we can check if it's fixed later on.

@koppor
Copy link
Member

koppor commented Dec 21, 2019

The code adds support for X11 primary selection clipboard (see #5482). This is essential for advanced linux users using the hidden powers of their system (and not migrating from Windows and thus not using things what Unix offers since 40 years).

Would it be possible to fix the code somewhere in JavaFX? - The code is open sourced: https://github.com/openjdk/jfx (hint by @dlemmermann). Refs my rant against JavaFX at https://twitter.com/koppor/status/1181926475957706753. That rant was too harsh, I know, but I did not expect these kind of issues (as also this one).

@koppor
Copy link
Member

koppor commented Dec 21, 2019

The linked JDK issue presents following workaround code. Maybe, this can be done here, too?

use InvalidationListener instead of ChangeListener and encapsulate access to selectedTextProperty in Platform.runLater (see provided test cases)

@koppor
Copy link
Member

koppor commented Dec 21, 2019

Just as an impression how stable the code in TextInputControl is:

grafik

@tobiasdiez
Copy link
Member Author

@koppor can you please take over this PR and try to implement the workaround. I don't have a Linux available to test it.

@koppor koppor self-assigned this Dec 21, 2019
@koppor
Copy link
Member

koppor commented Dec 21, 2019

Working on it

grafik

Update: openjdk/jfx#73

@koppor
Copy link
Member

koppor commented Dec 21, 2019

Ported the fix. Need to fire up my vcxsrv in my WSL as described at https://medium.com/@dhanar.santika/installing-wsl-with-gui-using-vcxsrv-6f307e96fac0.

@tobiasdiez
Copy link
Member Author

Cool! I guess we still need to use the above workaround until your fix is in a published JavaFX release.

@koppor
Copy link
Member

koppor commented Dec 22, 2019

Checked the fix. Works on Linux and Mac.

@koppor koppor removed their assignment Dec 22, 2019
@tobiasdiez tobiasdiez merged commit cd6f656 into master Dec 23, 2019
@tobiasdiez tobiasdiez deleted the fix5708 branch December 23, 2019 09:37
Siedlerchr added a commit that referenced this pull request Dec 23, 2019
* upstream/master:
  Fixes StringIndexOutOfBoundsException when cutting text (#5776)
  Bump org.beryx.jlink from 2.16.4 to 2.17.0 (#5782)
  Bump byte-buddy-parent from 1.10.5 to 1.10.6 (#5783)
  Fix line endings.
  Try to use implicit shell to enable variable correctly be set
  Fix branch name detection
  Update script to absolute path and new username
  Revert "Disable non-working cleanup_pr workflow"
  Switch to rsync (#5778)
  Fix Medline tests (#5774)
  Normalize line ending in test file (#5775)
  Fix Springer fetcher tests (#5773)
  Fix code style (#5772)
koppor pushed a commit that referenced this pull request Jan 1, 2022
f78c707 Update Turabian (full note) for 17.1.3.2 Reprint Editions (#5809)
2169ddc Create art-libraries-society-of-north-america-arlisna-reviews.csl (#5791)
94119a6 Create university-of-south-wales-harvard.csl (#5787)
470925c Update fachhochschule-sudwestfalen.csl (#5811)
1a9eff7 Create annals-of-public-and-cooperative-economics.csl (#5747)
d7477f2 Merge pull request #5368 from POBrien333/patch-862
113e683 Merge pull request #5812 from citation-style-language/apa-no-initials
62dacff Create universitat-oberta-de-catalunya-apa.csl
046482c Fix Organization Studies title
1213b95 Make oranization-studies dependent
c9641f4 Create apa-no-initials.csl
0b4e047 Modify american-journal-of-archaeology.csl (#5719)
ddeda4f Create journal-of-economic-impact.csl (#5707)
40c2696 Update gallia.csl (#5782)
5d5927a Create serbian-archives-of-medicine.csl (#5721)
2777954 Merge pull request #5807 from dhacker29/master
77e3fca Update Society of Biblical Literature Full Note for 6.1.6
4479a5a haaga-helia-university-of-applied-sciences-harvard.csl: no date cites need to be unique (#5726)
d00e046 Create university-of-roehampton-harvard.csl (#5732)
e76da40 Medicinski Razgledi -- fix locale
75b1554 Add original-date extra to proper place as per SBL Handbook 6.2.17-18 (#5725)
d43676e Update harvard-bournemouth-university.csl (#5667)
0312a39 Create ABNT NBR 6023:2018. UNESP – Faculdade de Engenharia de Guarati… (#5705)
6585ff9 Create sinergie-italian-journal-of-management.csl (#5776)
a7dc678 Create journal-of-global-health.csl (#5775)
02080ce Merge pull request #5800 from citation-style-language/validation-fixes
8b51d85 change s. d. to s.d. in french style for INBO reports (issue #2) (#5634)
1b4ec09 Create bloomsbury-academic.csl (#5741)
1f28d87 Create zeithistorische-forschungen.csl (#5766)
bb11942 Remove superfluous 'container' data from wiley-vch-books
06038a7 Remove et-al affixes
be96bd8 Remove et-al affixes from bibliotecae-it.csl
03a94e4 Remove more et-al affixes
07d7423 Revert non-et-al changes to universitat-basel-iberomanistik
f8e5fd8 Create medicinski-razgledi.csl (#5789)
b4df8ee Create dut-harvard.csl (#5762)
40855c4 Fix affixes on et-al
b4fe9b0 Merge pull request #5798 from citation-style-language/uris
3dc4aaf URL-encode documentation URLs
408a3a8 fixes citation-style-language/Sheldon#38
42aca5b Update biophysics-and-physicobiology.csl (#5751)
706bea0 Create universidade-do-porto-faculdade-de-engenharia-chicago-pt.csl (#5742)
269ff91 Update universidade-do-porto-faculdade-de-engenharia-chicago.csl (#5797)
0ba51e7 Update el-profesional-de-la-informacion.csl (#5785)
dac3baf Create arthropod-systematics-and-phylogeny.csl (#5772)
9dff241 Merge pull request #5796 from dhacker29/patch-1
35949f4 Update turabian-fullnote-bibliography-no-ibid.csl
ccfb661 Merge pull request #5793 from benjaminmoon/patch-2
520e127 Update frontiers-medical-journals.csl (#5740)
ab629ab Update natura-croatica.csl (#5795)
60b2b17 Rename turabian-fullnote-bibliography-no-ibid to turabian-fullnote-bibliography-no-ibid.csl
ad4edff Create turabian-fullnote-bibliography-no-ibid
d9b956c Update monographs-of-the-palaeontographical-society.csl
3648ae6 Merge pull request #5792 from StianOby/fix-no-page-number-articles
e15b2f7 Update norsk-henvisningsstandard-for-rettsvitenskapelige-tekster.csl
d8778cf Removed "page" (s. ) term for articles that do not have page numbers.
409017c add medium field for eBooks to MLA 8th

git-subtree-dir: buildres/csl/csl-styles
git-subtree-split: f78c707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cutting some of the bibtexkey raises error: Bale13 -> Bal13
3 participants