Hi, I have implemented a UI where there is a styledtextpane . I try to copy the text with a new line character and paste it inside the field and it gets pasted twice. When I try to delete each character using the backspace, it gives the following error:
`javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location
at java.desktop/javax.swing.text.GlyphView.getText(GlyphView.java:138)
at java.desktop/javax.swing.text.GlyphPainter1.paint(GlyphPainter1.java:118)
at java.desktop/javax.swing.text.GlyphView.paintTextUsingColor(GlyphView.java:484)
at java.desktop/javax.swing.text.GlyphView.paint(GlyphView.java:475)
at ui.StyledTextPane$StyledTextGlyphView.paint(StyledTextPane.java:1342)
at java.desktop/javax.swing.text.BoxView.paintChild(BoxView.java:162)
at java.desktop/javax.swing.text.BoxView.paint(BoxView.java:434)
at java.desktop/javax.swing.text.BoxView.paintChild(BoxView.java:162)
at java.desktop/javax.swing.text.BoxView.paint(BoxView.java:434)
at java.desktop/javax.swing.text.ParagraphView.paint(ParagraphView.java:573)
at java.desktop/javax.swing.text.BoxView.paintChild(BoxView.java:162)
at java.desktop/javax.swing.text.BoxView.paint(BoxView.java:434)
at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1538)
at java.desktop/javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:757)
at com.formdev.flatlaf.ui.FlatTextPaneUI.paintSafely(FlatTextPaneUI.java:215)
at java.desktop/javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:915)
at java.desktop/javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:894)`
Steps I tried to reproduce the issue:
Trying to copy the description from notepad++ and pasting it in field and later trying to edit the text (i.e. Deleting the text using backspace) error is encountered.
Actual image of text, when the paste happened.
This only happens when there is new line character.
Please help me in understanding the issue. @DevCharly
Hi, I have implemented a UI where there is a styledtextpane . I try to copy the text with a new line character and paste it inside the field and it gets pasted twice. When I try to delete each character using the backspace, it gives the following error:
`javax.swing.text.StateInvariantError: GlyphView: Stale view: javax.swing.text.BadLocationException: Invalid location
Steps I tried to reproduce the issue: Trying to copy the description from notepad++ and pasting it in field and later trying to edit the text (i.e. Deleting the text using backspace) error is encountered.
Actual image of text, when the paste happened.
This only happens when there is new line character.
Please help me in understanding the issue. @DevCharly