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

Unable to clear the codeArea #527

Closed
niranjannitesh opened this issue Jun 20, 2017 · 4 comments
Closed

Unable to clear the codeArea #527

niranjannitesh opened this issue Jun 20, 2017 · 4 comments

Comments

@niranjannitesh
Copy link

niranjannitesh commented Jun 20, 2017

I am unable to configure how to delete all the text content

@JordanMartinez
Copy link
Contributor

Have you tried area.clear()

@niranjannitesh
Copy link
Author

Caused by: java.lang.IllegalStateException: Cannot get the type of a change that neither inserts nor deletes anything.
	at org.fxmisc.richtext.model.TextChange.<init>(TextChange.java:31)
	at org.fxmisc.richtext.model.RichTextChange.<init>(RichTextChange.java:6)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$null$7(ReadOnlyStyledDocument.java:274)
	at org.reactfx.util.Tuple2.map(Tuple2.java:31)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$replace$8(ReadOnlyStyledDocument.java:271)
	at org.reactfx.util.Tuple2.map(Tuple2.java:31)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:270)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:260)
	at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.setStyleSpans(GenericEditableStyledDocumentBase.java:158)
	at org.fxmisc.richtext.model.SimpleEditableStyledDocument.setStyleSpans(SimpleEditableStyledDocument.java:7)
	at org.fxmisc.richtext.GenericStyledArea.setStyleSpans(GenericStyledArea.java:1281)
	at borland.c.FXMLDocumentController.lambda$addCodeArea$1(FXMLDocumentController.java:65)
	at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
	at org.reactfx.FilterStream.lambda$observeInputs$0(FilterStream.java:20)
	at org.reactfx.util.QueuingStreamNotifications.lambda$head$0(NotificationAccumulator.java:217)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.SuspendableBase.resume(SuspendableBase.java:64)
	at org.reactfx.CloseableOnceGuard.close(Guard.java:49)
	at org.reactfx.MultiGuard.close(Guard.java:83)
	at org.reactfx.Suspendable$1.resumeSource(Suspendable.java:118)
	at org.reactfx.Suspendable$1.suspendSource(Suspendable.java:104)
	at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)
	at org.reactfx.EventStreams$3.lambda$observeInputs$0(EventStreams.java:105)
	at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786)
	at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
	at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
	at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
	at org.reactfx.SuspendableBoolean.release(SuspendableBoolean.java:24)
	at org.reactfx.CloseableOnceGuard.close(Guard.java:49)
	at org.reactfx.Suspendable.suspendWhile(Suspendable.java:49)
	at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.update(GenericEditableStyledDocumentBase.java:222)
	at org.reactfx.util.Tuple3.exec(Tuple3.java:43)
	at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.replace(GenericEditableStyledDocumentBase.java:129)
	at org.fxmisc.richtext.model.SimpleEditableStyledDocument.replace(SimpleEditableStyledDocument.java:7)
	at org.fxmisc.richtext.GenericStyledArea.replace(GenericStyledArea.java:1302)
	at org.fxmisc.richtext.GenericStyledArea.replaceText(GenericStyledArea.java:1297)
	at org.fxmisc.richtext.model.EditActions.clear(EditActions.java:140)
	at borland.c.FXMLDocumentController.openFile(FXMLDocumentController.java:83)
	... 53 more

@niranjannitesh
Copy link
Author

niranjannitesh commented Jun 20, 2017

codeArea.setStyleSpans(0, computeHighlighting(codeArea.getText()));

@JordanMartinez
Copy link
Contributor

JordanMartinez commented Jun 20, 2017

Caused by: java.lang.IllegalStateException: Cannot get the type of a change that neither inserts nor deletes anything.

That's a known bug in the 0.7-M4 and 0.7-M5 releases. Until Tomas makes a new release, use 0.7-M3, or use the Jitpack gradle plugin (See the "Snapshots" section) to use a commit that is newer or equal to commit 77086ab1c3306e0f6a7ec0be33f8592aab2b0389 (#500)

Also, calling codeArea.setStyleSpans(0, computeHighlighting(codeArea.getText())) will cause an undesired scroll jump. You can see #390 for more details.

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

No branches or pull requests

2 participants