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

Crash on copy/paste with indent #352

Open
tonydroy opened this issue Jun 29, 2024 · 0 comments
Open

Crash on copy/paste with indent #352

tonydroy opened this issue Jun 29, 2024 · 0 comments

Comments

@tonydroy
Copy link

I am not sure if copy/paste is supposed to preserve paragraph decorations in the current version (6/29/24). However, in the context of paragraph decorations, copy/paste either fails to preserve decorations or crashes.

I have attached a minimal file to exhibit the problem. CopyWithParDecTest opens the RTA with three short paragraphs: the first with neither spacing nor indent, the second with spacing but not indent, the third with indent but not spacing.

  1. Copy and paste the first paragraph to the end: Everything is fine.
  2. Copy and paste the second paragraph to the end: The paragraph spacing is gone.
  3. Copy and paste the third paragraph to the end: CRASH!
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Position is outside text bounds
	at com.gluonhq.richtextarea.model.InsertCmd.doRedo(PieceTable.java:699)
	at com.gluonhq.richtextarea.model.InsertCmd.doRedo(PieceTable.java:667)
	at com.gluonhq.richtextarea.undo.AbstractCommand.execute(AbstractCommand.java:43)
	at com.gluonhq.richtextarea.undo.CommandManager.execute(CommandManager.java:55)
	at com.gluonhq.richtextarea.model.PieceTable.insert(PieceTable.java:383)
	at com.gluonhq.richtextarea.viewmodel.RichTextAreaViewModel.insert(RichTextAreaViewModel.java:380)
	at com.gluonhq.richtextarea.viewmodel.PasteDocumentCmd.lambda$doRedo$0(PasteDocumentCmd.java:52)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
	at com.gluonhq.richtextarea.viewmodel.PasteDocumentCmd.doRedo(PasteDocumentCmd.java:47)
	at com.gluonhq.richtextarea.viewmodel.PasteDocumentCmd.doRedo(PasteDocumentCmd.java:35)
	at com.gluonhq.richtextarea.undo.AbstractCommand.execute(AbstractCommand.java:43)
	at com.gluonhq.richtextarea.undo.CommandManager.execute(CommandManager.java:55)
	at com.gluonhq.richtextarea.viewmodel.RichTextAreaViewModel.clipboardPaste(RichTextAreaViewModel.java:484)
	at com.gluonhq.richtextarea.viewmodel.ActionCmdPaste.apply(ActionCmdPaste.java:38)
	at com.gluonhq.richtextarea.RichTextAreaSkin.execute(RichTextAreaSkin.java:902)
	at com.gluonhq.richtextarea.RichTextAreaSkin.keyPressedListener(RichTextAreaSkin.java:912)
	at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at [email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at [email protected]/javafx.event.Event.fireEvent(Event.java:198)
	at [email protected]/javafx.scene.Scene.processKeyEvent(Scene.java:2195)
	at [email protected]/javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2716)
	at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:218)
	at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:150)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$1(GlassViewEventHandler.java:250)
	at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:430)
	at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:249)
	at [email protected]/com.sun.glass.ui.View.handleKeyEvent(View.java:542)
	at [email protected]/com.sun.glass.ui.View.notifyKey(View.java:966)
	at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
	at `java.base/java.lang.Thread.run(Thread.java:1570)`

For what it is worth, copying all three to the end does not result in an exception, but loses both spacing and indent.

CopyWithParDecTest.zip

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

1 participant