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

IndexOutOfBounds in certain situations. #1

Closed
SKeeneCode opened this issue Feb 10, 2021 · 5 comments
Closed

IndexOutOfBounds in certain situations. #1

SKeeneCode opened this issue Feb 10, 2021 · 5 comments

Comments

@SKeeneCode
Copy link

SKeeneCode commented Feb 10, 2021

Firstly, this repository is great, and has been amazing help. I've been rewriting it in kotlin for my project and has been huge fun. Thank you for putting this together @Jugen its really made RichTextFX accessible for me.

I've come across some bugs when testing, and I've verified the same bugs exist in just plain java.

Bug 1
Steps to reproduce:

  • Create a blank StyledSegmentTextArea (or launch any of the demos and remove the contents).
  • Type any letter.
  • Press left to move the caret to the very start of the text.
  • Press right -> IndexOutOfBounds.

Potential Fix (unsure if has undesired consequences)

Change this line
colPos >= pLen-1 to colPos > pLen-1

Bug 2

  • Steps to reproduce.
  • Launch the IndentDemo.
  • Delete everything.
  • Press Enter twice to create an indent:

image

  • Try and delete the indent -> IndexOutOfBounds

No idea on a fix.

@SKeeneCode
Copy link
Author

Bug 3
Steps to reproduce:

  • Launch the IndentDemo
  • Press CTRL+A to select everything.
  • Press delete -> IndexOutOfBounds

@SKeeneCode
Copy link
Author

SKeeneCode commented Feb 10, 2021

Bug 4

Steps to reproduce:

  • Launch the IndentDemo
  • Place the cursor where the redline is:

image

  • Click and drag to highlight/select the indent.
  • The cursor will become trapped and unable to escape and a Stackoverflow will occur.

@Jugen
Copy link
Owner

Jugen commented Feb 10, 2021

Hi @SKeeneCode glad this has helped you and thank you for reporting the issues above, I have submitted a PR that addresses all of them.

Note that IndentSegment was an experimental feature that arose out of RichTextFX #840, and I'm not confident that it is actually the way this feature should be added. That being said I do use the StyledSegmentTextArea in my production code for displaying LabelSegments.

@SKeeneCode
Copy link
Author

SKeeneCode commented Feb 11, 2021

Thanks for the quick fix! Unfortunately I did find another :) If you place the caret on an empty line, press enter -> delete -> enter -> delete -> IndexOutOfBounds

I thought the indents might make a good base to implement bullet point lists. However I see that there is an implementation of bullet point lists in the rich text demo so I'll have a look at that.

@tchudyk
Copy link

tchudyk commented Jun 23, 2021

Hi, I'm not sure but maybe my last fix solved this issue too - FXMisc/Flowless#92 - I had also problems with IndexOutOfBoundsException.

@Jugen Jugen closed this as completed Jul 21, 2021
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

3 participants